Esempio n. 1
0
        public InstructorIsConsistentValidation()
        {
            var instructorIdentification = new InstructorMustContainIdentificationSpecification();
            var instructorEmail          = new InstructorMustHaveEmailValidSpecification();
            var instructorBeOlder        = new InstructorMustBeOlderSpecification();

            Add("instructorIdentification", new Rule <Instructor>(instructorIdentification, "A identificação do Instrutor deve conter no mínimo 3 caracteres."));
            Add("instructorEmail", new Rule <Instructor>(instructorEmail, "Instrutor informou um e-mail inválido."));
            Add("instructorBeOlder", new Rule <Instructor>(instructorBeOlder, "Instrutor não tem maioridade para cadastro."));
        }
Esempio n. 2
0
        public void Instructor_BeOlder_IsNotSatisfied()
        {
            // Arrange
            var instructor = new Instructor
            {
                BirthDate = new DateTime(2016, 08, 26)
            };

            // Act
            var specificationReturn = new InstructorMustBeOlderSpecification().IsSatisfiedBy(instructor);

            // Assert
            Assert.IsFalse(specificationReturn);
        }