コード例 #1
0
        public void GetPreviousDate_ReturnsPreviousMonth()
        {
            var date   = new DateTime(2013, 6, 7);
            var policy = new Monthly30DayPeriodPolicy();

            Assert.That(policy.GetPreviousDate(date), Is.EqualTo(new DateTime(2013, 5, 7)));
        }
コード例 #2
0
        public void GetNumberOfPeriodsInYear_Returns12()
        {
            var         date       = new DateTime(2013, 6, 7);
            var         policy     = new Monthly30DayPeriodPolicy();
            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));
        }
コード例 #3
0
        public void GetNumberOfDays_Returns30()
        {
            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 Monthly30DayPeriodPolicy();

            Assert.That(policy.GetNumberOfDays(date1), Is.EqualTo(30));
            Assert.That(policy.GetNumberOfDays(date2), Is.EqualTo(30));
            Assert.That(policy.GetNumberOfDays(date3), Is.EqualTo(30));
            Assert.That(policy.GetNumberOfDays(date4), Is.EqualTo(30));
        }