Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        public static DateTime GetAcademicYearDateFor(this AcademicYearDates forThisDate, DateTime candidate)
        {
            var academicYearDateDefinition = _academicYearDateDefinitions[forThisDate];

            return(new DateTime(academicYearDateDefinition.YearCalculation(candidate), academicYearDateDefinition.Month, academicYearDateDefinition.Day));
        }
Exemplo n.º 4
0
 /// <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);