public void Validate_Error() { var learningDelivery = new TestLearningDelivery() { ProgTypeNullable = 1, AimTypeNullable = 1, LearnStartDateNullable = new DateTime(2017, 1, 1), }; var dateOfBirth = new DateTime(2002, 1, 1); var learner = new TestLearner() { DateOfBirthNullable = dateOfBirth, LearningDeliveries = new TestLearningDelivery[] { learningDelivery } }; var dd04Mock = new Mock <IDD04>(); var dd07Mock = new Mock <IDD07>(); var validationDataServiceMock = new Mock <IValidationDataService>(); var academicYearCalendarServiceMock = new Mock <IAcademicYearCalendarService>(); var validationErrorHandlerMock = new Mock <IValidationErrorHandler>(); dd04Mock.Setup(dd => dd.Derive(learner.LearningDeliveries, learningDelivery)).Returns(new DateTime(2017, 1, 1)); dd07Mock.Setup(dd => dd.Derive(1)).Returns("Y"); validationDataServiceMock.SetupGet(vds => vds.ApprencticeProgAllowedStartDate).Returns(new DateTime(2016, 8, 1)); academicYearCalendarServiceMock.Setup(aycs => aycs.LastFridayInJuneForDateInAcademicYear(dateOfBirth.AddYears(16))).Returns(new DateTime(2018, 6, 29)); Expression <Action <IValidationErrorHandler> > handle = veh => veh.Handle("DateOfBirth_48", null, null, null); validationErrorHandlerMock.Setup(handle); var rule = new DateOfBirth_48Rule(dd04Mock.Object, dd07Mock.Object, validationDataServiceMock.Object, academicYearCalendarServiceMock.Object, validationErrorHandlerMock.Object); rule.Validate(learner); validationErrorHandlerMock.Verify(handle, Times.Once); }
public void DD07ConditionMet_False(string dd07) { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.DD07ConditionMet(dd07).Should().BeFalse(); }
public void DD04ConditionMet_Null() { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.DD04ConditionMet(null, new DateTime(2017, 8, 1), new DateTime(2018, 6, 1)).Should().BeFalse(); }
public void DD07ConditionMet_True() { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.DD07ConditionMet("Y").Should().BeTrue(); }
public void DD04ConditionMet_False(int year, int month, int day) { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.DD04ConditionMet(new DateTime(year, month, day), new DateTime(2017, 8, 1), new DateTime(2018, 6, 1)).Should().BeFalse(); }
public void LearnerConditionMet_False() { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.LearnerConditionMet(null).Should().BeFalse(); }
public void LearnerConditionMet_True() { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.LearnerConditionMet(new DateTime(2018, 1, 1)).Should().BeTrue(); }
public void Exclude_False() { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.Exclude(24).Should().BeFalse(); }
public void Exclude_True() { var rule = new DateOfBirth_48Rule(null, null, null, null); rule.Exclude(25).Should().BeTrue(); }