public void ValidatePasses_OutsideAgeRange() { var validationErrorHandlerMock = BuildValidationErrorHandlerMockForNoError(); var academicYearServiceMock = new Mock <IAcademicYearDataService>(); academicYearServiceMock.Setup(m => m.AugustThirtyFirst()).Returns(new DateTime(2018, 8, 31)); var dateTimeServiceMock = new DateTimeQueryService(); var testLearner = new TestLearner { DateOfBirthNullable = new DateTime(1993, 8, 31), LearnerFAMs = new List <TestLearnerFAM> { new TestLearnerFAM { LearnFAMType = LearnerFAMTypeConstants.HNS } }, LearningDeliveries = new List <TestLearningDelivery> { new TestLearningDelivery { FundModel = FundModels.Age16To19ExcludingApprenticeships } } }; NewRule(validationErrorHandlerMock.Object, academicYearServiceMock.Object, dateTimeServiceMock).Validate(testLearner); VerifyErrorHandlerMock(validationErrorHandlerMock); }
public void YearsBetween(string start, string end, int years) { var queryService = new DateTimeQueryService(); queryService.YearsBetween(DateTime.Parse(start), DateTime.Parse(end)).Should().Be(years); }