Пример #1
0
        public CourseIsConsistentValidation()
        {
            var courseIdentification = new CourseMustContainIdentificationSpecification();
            var coursePrice          = new CoursePriceCanNotBeNegativeSpecification();
            var courseCourseTypeId   = new CourseMustBeContainCourseTypeSpecification();
            var courseInstructor     = new CourseMustBeContainInstructorSpecification();

            Add("courseIdentification", new Rule <Course>(courseIdentification, "A identificação do Curso deve conter no mínimo 3 caracteres."));
            Add("coursePrice", new Rule <Course>(coursePrice, "Preço do Curso não conter valores negativos."));
            Add("courseCourseTypeId", new Rule <Course>(courseCourseTypeId, "Curso obrigatoriamente deve conter um Tipo de Curso."));
            Add("courseInstructor", new Rule <Course>(courseInstructor, "Curso obrigatoriamente deve conter um Instrutor."));
        }
Пример #2
0
        public void Course_PriceSpecification_IsNotSatisfied()
        {
            // Arrange
            var course = new Course
            {
                Price = -0.02m
            };

            // Act
            var specificationReturn = new CoursePriceCanNotBeNegativeSpecification().IsSatisfiedBy(course);

            // Assert
            Assert.IsFalse(specificationReturn);
        }