Пример #1
0
 public void GetNumberOfPeriodsInYear_360DayYearPolicy_Returns360()
 {
     var date = new DateTime(2013, 6, 7);
     var policy = new DailyPeriodPolicy();
     var yearPolicy = new ThreeHundredSixtyDayYearPolicy();
     Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(360));
 }
Пример #2
0
 public void GetNumberOfPeriodsInYear_WeeklyPeriodAnd360DayYearPolicy_ReturnsCorrectNumber()
 {
     var date = new DateTime(2013, 6, 11);
     var policy = new CustomPeriodPolicy(7);
     var yearPolicy = new ThreeHundredSixtyDayYearPolicy();
     Assert.That(Math.Round(policy.GetNumberOfPeriodsInYear(date, yearPolicy), 2), Is.EqualTo(51.43));
 }
Пример #3
0
 public void YearPolicy_360DayYearPolicy_Returns360()
 {
     var yearPolicy = new ThreeHundredSixtyDayYearPolicy();
     var nonLeapYearDate = new DateTime(2013, 6, 7);
     var leapYearDate = new DateTime(2012, 6, 7);
     Assert.That(yearPolicy.GetNumberOfDays(nonLeapYearDate), Is.EqualTo(360));
     Assert.That(yearPolicy.GetNumberOfDays(leapYearDate), Is.EqualTo(360));
 }
Пример #4
0
 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));
 }