Example #1
0
        public Country GenerateValidCountryWithInvalidStates()
        {
            var country      = GenerateValidCountry();
            var stateFixture = new StateTestFixture();

            country.AddState(stateFixture.GenerateInvalidState());
            country.AddState(stateFixture.GenerateInvalidState());
            country.AddState(stateFixture.GenerateInvalidState());

            return(country);
        }
Example #2
0
        public Country GenerateInvalidCountryWithStates()
        {
            var country      = new Country(Guid.NewGuid(), "");
            var stateFixture = new StateTestFixture();

            country.AddState(stateFixture.GenerateInvalidState());
            country.AddState(stateFixture.GenerateInvalidState());
            country.AddState(stateFixture.GenerateInvalidState());

            return(country);
        }
Example #3
0
        public async Task StateService_AddNewStateService_ShouldntHaveSuccess()
        {
            //Arrange
            var state        = _stateTestFixture.GenerateInvalidState();
            var mocker       = new AutoMocker();
            var stateService = mocker.CreateInstance <ServiceState>();

            //Act
            await stateService.AddAsyncUow(state);

            //Asert
            mocker.GetMock <IRepositoryState>().Verify(r => r.Add(state), Times.Never);
            mocker.GetMock <IUnitOfWork>().Verify(u => u.CommitAsync(), Times.Never);
            mocker.GetMock <INotifier>().Verify(n => n.Handle(It.IsAny <Notification>()), Times.Exactly(2));
        }
Example #4
0
        public void State_ValidateNewState_ShouldBeInvalid()
        {
            //Arrange
            var state = _stateTestFixture.GenerateInvalidState();

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

            //Assert
            Assert.False(result.IsValid);
            Assert.True(result.Errors.Any());

            Assert.Contains(StateValidation.StateNameRequired, result.Errors.Select(e => e.ErrorMessage));
        }