public void GetNumberOfPeriodsInYear_WeeklyPeriodAndActualDayYearPolicy_ReturnsCorrectNumber()
 {
     var date = new DateTime(2013, 6, 11);
     var policy = new CustomPeriodPolicy(7);
     var yearPolicy = new ActualNumberOfDayYearPolicy();
     Assert.That(Math.Round(policy.GetNumberOfPeriodsInYear(date, yearPolicy), 2), Is.EqualTo(52.14));
 }
Beispiel #2
0
 public void YearPolicy_ActualDayYearPolicy_ReturnsNumberOfDaysInYear()
 {
     var yearPolicy = new ActualNumberOfDayYearPolicy();
     var nonLeapYearDate = new DateTime(2013, 6, 7);
     var leapYearDate = new DateTime(2012, 6, 7);
     Assert.That(yearPolicy.GetNumberOfDays(nonLeapYearDate), Is.EqualTo(365));
     Assert.That(yearPolicy.GetNumberOfDays(leapYearDate), Is.EqualTo(366));
 }
 public void GetNumberOfPeriodsInYear_ActualDayYearPolicy_ReturnsActualNumberOfDays()
 {
     var date = new DateTime(2013, 6, 7);
     var policy = new DailyPeriodPolicy();
     var yearPolicy = new ActualNumberOfDayYearPolicy();
     Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(365));
     date = new DateTime(2012, 6, 7);
     Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(366));
 }
 public void GetNumberOfPeriodsInYear_Returns12()
 {
     var date = new DateTime(2013, 6, 7);
     var policy = new MonthlyPeriodPolicy();
     IYearPolicy yearPolicy = new ActualNumberOfDayYearPolicy();
     Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(12));
     yearPolicy = new ThreeHundredSixtyDayYearPolicy();
     Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(12));
     yearPolicy = new ThreeHundredSixtyFiveDayYearPolicy();
     Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(12));
 }