コード例 #1
0
        public async Task StartDate_Must_be_no_later_than_one_year_after_the_end_of_the_current_teaching_year()
        {
            var fixture = new EditApprenticeshipValidationServiceTestsFixture();

            fixture.SetupMockContextApprenticeship();
            var endOfCurrentTeachingYear = fixture.GetEndOfCurrentTeachingYear();

            var request = fixture.CreateValidationRequest(startYear: endOfCurrentTeachingYear.AddYears(1).Year, startMonth: endOfCurrentTeachingYear.Month + 1, endYear: endOfCurrentTeachingYear.Year + 2, endMonth: endOfCurrentTeachingYear.Month);

            var result = await fixture.Validate(request);

            Assert.AreEqual(1, result.Errors.Count);
            Assert.AreEqual("The start date must be no later than one year after the end of the current teaching year", result.Errors[0].ErrorMessage);
            Assert.AreEqual("StartDate", result.Errors[0].PropertyName);
        }