Exemple #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."));
        }
Exemple #2
0
        public void Instructor_IdentificationSpecification_IsNotSatisfied()
        {
            // Arrange
            var instructor = new Instructor
            {
                Identification = "Jo"
            };

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

            // Assert
            Assert.IsFalse(specificationReturn);
        }
Exemple #3
0
        public void Instructor_IdentificationSpecification_IsSatisfied()
        {
            // Arrange
            var instructor = new Instructor
            {
                Identification = "José Antonio Martins"
            };

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

            // Assert
            Assert.IsTrue(specificationReturn);
        }