public void SalaryBased_Validation_Excess() { var input = new SalaryBasedCourseEnrichmentViewModel { AboutCourse = Times("word ", 401), InterviewProcess = Times("word ", 251), HowSchoolPlacementsWork = Times("word ", 351), Qualifications = Times("word ", 101), PersonalQualities = Times("word ", 101), OtherRequirements = Times("word ", 101), SalaryDetails = Times("word ", 251), CourseLength = CourseLength.OneYear, }; var validationResults = Validate(input); validationResults.Count.Should().Be(7); AssertMessageFor(validationResults, "AboutCourse", "Reduce the word count for about this course"); AssertMessageFor(validationResults, "InterviewProcess", "Reduce the word count for interview process"); AssertMessageFor(validationResults, "HowSchoolPlacementsWork", "Reduce the word count for how school placements work"); AssertMessageFor(validationResults, "Qualifications", "Reduce the word count for qualifications needed"); AssertMessageFor(validationResults, "PersonalQualities", "Reduce the word count for personal qualities"); AssertMessageFor(validationResults, "OtherRequirements", "Reduce the word count for other requirements"); AssertMessageFor(validationResults, "SalaryDetails", "Reduce the word count for salary"); }
private static BaseCourseEnrichmentViewModel GetCourseEnrichmentViewModel(UcasCourseEnrichmentGetModel ucasCourseEnrichmentGetModel, bool isSalary, CourseRouteDataViewModel routeData = null) { BaseCourseEnrichmentViewModel result = null; ucasCourseEnrichmentGetModel = ucasCourseEnrichmentGetModel ?? new UcasCourseEnrichmentGetModel(); var enrichmentModel = ucasCourseEnrichmentGetModel?.EnrichmentModel ?? new CourseEnrichmentModel(); if (isSalary) { result = new SalaryBasedCourseEnrichmentViewModel() { AboutCourse = enrichmentModel.AboutCourse, InterviewProcess = enrichmentModel.InterviewProcess, HowSchoolPlacementsWork = enrichmentModel.HowSchoolPlacementsWork, Qualifications = enrichmentModel.Qualifications, PersonalQualities = enrichmentModel.PersonalQualities, OtherRequirements = enrichmentModel.OtherRequirements, CourseLength = enrichmentModel.CourseLength.GetCourseLength(), CourseLengthInput = enrichmentModel.CourseLength.GetCourseLengthInput(), SalaryDetails = enrichmentModel.SalaryDetails, DraftLastUpdatedUtc = ucasCourseEnrichmentGetModel.UpdatedTimestampUtc, LastPublishedUtc = ucasCourseEnrichmentGetModel.LastPublishedTimestampUtc, RouteData = routeData }; } else { result = new FeeBasedCourseEnrichmentViewModel() { AboutCourse = enrichmentModel.AboutCourse, InterviewProcess = enrichmentModel.InterviewProcess, HowSchoolPlacementsWork = enrichmentModel.HowSchoolPlacementsWork, Qualifications = enrichmentModel.Qualifications, PersonalQualities = enrichmentModel.PersonalQualities, OtherRequirements = enrichmentModel.OtherRequirements, CourseLength = enrichmentModel.CourseLength.GetCourseLength(), CourseLengthInput = enrichmentModel.CourseLength.GetCourseLengthInput(), FeeUkEu = enrichmentModel.FeeUkEu.GetFeeValue(), FeeInternational = enrichmentModel.FeeInternational.GetFeeValue(), FeeDetails = enrichmentModel.FeeDetails, FinancialSupport = enrichmentModel.FinancialSupport, DraftLastUpdatedUtc = ucasCourseEnrichmentGetModel.UpdatedTimestampUtc, LastPublishedUtc = ucasCourseEnrichmentGetModel.LastPublishedTimestampUtc, RouteData = routeData }; } return(result); }
public void SalaryBased_Validation_Empty() { var input = new SalaryBasedCourseEnrichmentViewModel { }; var validationResults = Validate(input); validationResults.Count.Should().Be(5); AssertMessageFor(validationResults, "AboutCourse", "Enter details about this course"); AssertMessageFor(validationResults, "Qualifications", "Enter details for about qualifications needed"); AssertMessageFor(validationResults, "HowSchoolPlacementsWork", "Enter details about school placements"); AssertMessageFor(validationResults, "SalaryDetails", "Give details about salary"); AssertMessageFor(validationResults, "CourseLength", "Give details about course length"); }
public void SalaryBased_Validation_Full() { var input = new SalaryBasedCourseEnrichmentViewModel { AboutCourse = "AboutCourse", Qualifications = "Qualifications", HowSchoolPlacementsWork = "HowSchoolPlacementsWork", SalaryDetails = "SalaryDetails", CourseLength = CourseLength.Other, }; var validationResults = Validate(input); validationResults.Count.Should().Be(0); }