public void GetNumberOfPeriodsInYear_WeeklyPeriodAnd365DayYearPolicy_ReturnsCorrectNumber()
        {
            var date       = new DateTime(2013, 6, 11);
            var policy     = new CustomPeriodPolicy(7);
            var yearPolicy = new ThreeHundredSixtyFiveDayYearPolicy();

            Assert.That(Math.Round(policy.GetNumberOfPeriodsInYear(date, yearPolicy), 2), Is.EqualTo(52.14));
        }
示例#2
0
        public void YearPolicy_365DayYearPolicy_Returns365()
        {
            var yearPolicy      = new ThreeHundredSixtyFiveDayYearPolicy();
            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(365));
        }
        public void GetNumberOfPeriodsInYear_365DayYearPolicy_Returns365()
        {
            var date       = new DateTime(2013, 6, 7);
            var policy     = new DailyPeriodPolicy();
            var yearPolicy = new ThreeHundredSixtyFiveDayYearPolicy();

            Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(365));
            date = new DateTime(2012, 6, 7);
            Assert.That(policy.GetNumberOfPeriodsInYear(date, yearPolicy), Is.EqualTo(365));
        }
示例#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));
 }