public void GetAcademicYearFor_WrongYear(string candidate, AcademicYearDates forThisDate, string expectation) { var testDate = DateTime.Parse(candidate); var expectedResult = DateTime.Parse(expectation); var sut = NewService(); var result = sut.GetAcademicYearOfLearningDate(testDate, forThisDate); result.Should().Be(expectedResult); }
public void GetAcademicYearOfLearningDateMeetsExpectation(string candidate, AcademicYearDates forThisDate, string expectation) { // arrange var sut = NewService(); var testDate = DateTime.Parse(candidate); // act var result = sut.GetAcademicYearOfLearningDate(testDate, forThisDate); // assert result.Should().Be(DateTime.Parse(expectation)); }
public static DateTime GetAcademicYearDateFor(this AcademicYearDates forThisDate, DateTime candidate) { var academicYearDateDefinition = _academicYearDateDefinitions[forThisDate]; return(new DateTime(academicYearDateDefinition.YearCalculation(candidate), academicYearDateDefinition.Month, academicYearDateDefinition.Day)); }
/// <summary> /// Gets an academic year of learning date. /// </summary> /// <param name="candidate">The candidate, representing a point of reference for /// any current academic year where a calcuation can be made /// based on the required 'academic year date' operation</param> /// <param name="yearDate">The academic year date (of interest)</param> /// <returns> /// an academic date for the year of learning /// </returns> public DateTime GetAcademicYearOfLearningDate(DateTime candidate, AcademicYearDates yearDate) => yearDate.GetAcademicYearDateFor(candidate);