示例#1
0
        public void State_ValidateNewStateDisabled_ShouldBeDisabledAndInvalid()
        {
            //Arrange
            var state = _stateTestFixture.GenerateValidState();

            //Act
            var result = state.ValidateState();

            //Assert
            Assert.False(result.IsValid);
            Assert.NotEmpty(result.Errors);
        }
示例#2
0
        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);
        }
示例#3
0
        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));
        }