public void State_ValidateNewStateDisabled_ShouldBeDisabledAndInvalid() { //Arrange var state = _stateTestFixture.GenerateValidState(); //Act var result = state.ValidateState(); //Assert Assert.False(result.IsValid); Assert.NotEmpty(result.Errors); }
public async Task StateService_AddNewStateService_ShouldHaveSuccess() { //Arrange var countryFixture = new CountryTestFixture(); var state = _stateTestFixture.GenerateValidState(countryFixture.GenerateValidCountry()); var mocker = new AutoMocker(); var stateService = mocker.CreateInstance <ServiceState>(); mocker.GetMock <IUnitOfWork>().Setup(u => u.CommitAsync()).Returns(Task.FromResult(true)); //Act await stateService.AddAsyncUow(state); //Assert mocker.GetMock <IRepositoryState>().Verify(r => r.Add(state), Times.Once); mocker.GetMock <IUnitOfWork>().Verify(u => u.CommitAsync(), Times.Once); }
public List <City> GenerateCity(int qty) { var faker = new Faker <City>("pt_BR"); var stateFixture = new StateTestFixture(); return(faker.CustomInstantiator(f => new City(Guid.NewGuid(), f.Address.City(), stateFixture.GenerateValidState())).Generate(qty)); }