public Country GenerateValidCountryWithStates() { var stateFixture = new StateTestFixture(); var country = GenerateValidCountry(); country.AddStates(stateFixture.GenerateStates(quantity: 3, country: country)); return(country); }
public async Task StateService_GetAll_ShouldHasSuccess() { //Arrange var mocker = new AutoMocker(); mocker.GetMock <IRepositoryState>() .Setup(s => s.GetAllStatesAsync(It.IsAny <int>(), It.IsAny <int>())) .Returns(Task.FromResult((IEnumerable <State>)_stateTestFixture.GenerateStates(10))); var stateService = mocker.CreateInstance <ServiceState>(); //Act var states = await stateService.GetAllAsync(It.IsAny <int>(), It.IsAny <int>()); //Assert states.Should().HaveCount(10); Assert.False(states.Count(s => !s.IsActive) > 0); }