示例#1
0
        public void ScheduleEveryMonthOn_ExceptionTest()
        {
            var today = DateTime.Now;
            var dueAt = today.AddSeconds(-10).TimeOfDay;
            var startDate = today.AddMonths(3);
            var endDate = startDate.AddMonths(4);

            var day = 28;
            MonthlySchedule ms = new MonthlySchedule(dueAt, startDate, endDate);
            ms.ScheduleEveryMonthOnDay(day);
        }
示例#2
0
        public void ScheduleOnFirstDayOfMonth_StartDateInFuture()
        {
            var dueAt = DateTime.Now.AddSeconds(10).TimeOfDay;
            var startDate = DateTime.Now.AddMonths(3);
            var endDate = startDate.AddMonths(4);

            MonthlySchedule ms = new MonthlySchedule(dueAt, startDate, endDate);
            ms.ScheduleOnFirstDayOfEveryMonth();

            var expected = GetComingDayOfTheMonth(startDate, 1, dueAt);
            Assert.AreEqual(expected, ms.DueDateTime);
        }
示例#3
0
        public void ScheduleEveryMonthOnDaysTest()
        {
            DateTime today = DateTime.Now;
            var dueAt = today.AddSeconds(-10).TimeOfDay;
            var startDate = today.AddMonths(3);
            var endDate = startDate.AddMonths(4);

            MonthlySchedule ms = new MonthlySchedule(dueAt, startDate, endDate);
            int[] days = new int[] { 1, 7, 10, 23, 4 };
            ms.ScheduleEveryMonthOnDays(days);

            var expectedDateTime = GetComingDayOfTheMonthFrom(startDate, days, dueAt);
            Assert.AreEqual(expectedDateTime, ms.DueDateTime);
        }
示例#4
0
        public void ScheduleEveryMonthOn10Test()
        {
            DateTime today = DateTime.Now;
            var dueAt = today.AddSeconds(-10).TimeOfDay;
            var startDate = today.AddMonths(3);
            var endDate = startDate.AddMonths(4);

            var day = 10;
            MonthlySchedule ms = new MonthlySchedule(dueAt, startDate, endDate);
            ms.ScheduleEveryMonthOnDay(day);

            var expectedDateTime = GetComingDayOfTheMonth(startDate, day, dueAt);
            Assert.AreEqual(expectedDateTime, ms.DueDateTime);
        }
示例#5
0
        public void ScheduleOnTheLastOfTheMonth_StartDateInFuture()
        {
            var today = DateTime.Now;
            var dueDateTime = today.AddSeconds(10).TimeOfDay;
            var startDate = today.AddMonths(3);
            var endDate = startDate.AddMonths(4);

            MonthlySchedule ms = new MonthlySchedule(dueDateTime, startDate, endDate);
            ms.ScheduleOnLastDayOfEveryMonth();

            var expected = GetLastDayOfMonth(startDate).Add(dueDateTime);
            Assert.AreEqual(expected, ms.DueDateTime);
        }