コード例 #1
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));
 }
コード例 #2
0
 public void GetNumberOfDays_ReturnsActualNumberOfDays()
 {
     var date1 = new DateTime(2013, 2, 1);
     var date2 = new DateTime(2013, 3, 1);
     var date3 = new DateTime(2013, 4, 1);
     var date4 = new DateTime(2013, 5, 1);
     var policy = new MonthlyPeriodPolicy();
     Assert.That(policy.GetNumberOfDays(date1), Is.EqualTo(31));
     Assert.That(policy.GetNumberOfDays(date2), Is.EqualTo(28));
     Assert.That(policy.GetNumberOfDays(date3), Is.EqualTo(31));
     Assert.That(policy.GetNumberOfDays(date4), Is.EqualTo(30));
 }
コード例 #3
0
 public void GetPreviousDate_ReturnsPreviousMonth()
 {
     var date = new DateTime(2013, 6, 7);
     var policy = new MonthlyPeriodPolicy();
     Assert.That(policy.GetPreviousDate(date), Is.EqualTo(new DateTime(2013, 5, 7)));
 }
コード例 #4
0
 public void GetNextDate_ReturnsNextMonth()
 {
     var date = new DateTime(2013, 6, 7);
     var policy = new MonthlyPeriodPolicy();
     Assert.That(policy.GetNextDate(date), Is.EqualTo(new DateTime(2013, 7, 7)));
 }