예제 #1
0
        public void When_FirstNameRuleNotApplyWhenIdLessThenZero()
        {
            var validator = new TestValidatorWithWhen();

            var em = new CreateEmployeeRequest
            {
                Id          = -1,
                FirstName   = "",
                EmployeeID  = 1,
                DateOfBirth = DateTime.Now.AddMonths(-1)
            };

            var validationResult = validator.Validate(em);

            Assert.That(validationResult.IsValid, Is.True);
        }
예제 #2
0
        public void When_FirstNameShouldBeNotEmptyWhenIdGreateThenZero()
        {
            var validator = new TestValidatorWithWhen();

            var em = new CreateEmployeeRequest
            {
                Id          = 2,
                FirstName   = "",
                EmployeeID  = 1,
                DateOfBirth = DateTime.Now.AddMonths(-1)
            };

            var validationResult = validator.Validate(em);

            Assert.That(validationResult.IsValid, Is.False);
        }