Beispiel #1
0
        public void CheckContextualValidationRules()
        {
            Func <CourseDelete.Request, ValidationMessageCollection> CallSut = request =>
            {
                var response = DomainServices.Dispatch(request);
                return(response.ValidationDetails);
            };

            Assert2.CheckContextualValidation("CourseId", "CourseId must have a minimum value of 1", () => CallSut(CreateValidRequest(p => p.CommandModel.CourseId = 0)));
        }
Beispiel #2
0
        public void CheckContextualValidationRules()
        {
            Func <CourseCreate.Request, ValidationMessageCollection> CallSut = request =>
            {
                var response = DomainServices.Dispatch(request);
                return(response.ValidationDetails);
            };

            Assert2.CheckContextualValidation("Title", "The field Title must be a string with a minimum length of 3 and a maximum length of 50.", () => CallSut(CreateValidRequest(p => p.CommandModel.Title = "X")));
            Assert2.CheckContextualValidation("Credits", "The field Credits must be between 1 and 5.", () => CallSut(CreateValidRequest(p => p.CommandModel.Credits = 0)));
        }
Beispiel #3
0
        public void CheckContextualValidationRules()
        {
            Func <CourseUpdate.Request, ValidationMessageCollection> CallSut = request =>
            {
                var reponse = DomainServices.Dispatch(request);
                return(reponse.ValidationDetails);
            };

            Assert2.CheckContextualValidation("CourseId", "CourseId cannot be less than 1", () => CallSut(CreateValidRequest(p => p.CommandModel.CourseID             = 0)));
            Assert2.CheckContextualValidation("DepartmentId", "DepartmentId cannot be less than 1", () => CallSut(CreateValidRequest(p => p.CommandModel.DepartmentID = 0)));
        }