Ejemplo n.º 1
0
        public void ScheduleEveryDayOfTheWeekTest()
        {
            var now = DateTime.Now;
            var dueAt = now.AddSeconds(10).TimeOfDay;
            var startDateTime = now;
            var endDateTime = startDateTime.AddDays(30);

            WeeklyScheduleBuilder builder = new WeeklyScheduleBuilder(dueAt, startDateTime, endDateTime);
            builder.ScheduleEveryDayOfTheWeek();
            var ws = builder.CreateWeeklySchedule();

            Assert.AreEqual(startDateTime.Date.Add(dueAt), ws.DueDateTime);
        }
Ejemplo n.º 2
0
        public void ScheduleOnSundayOnly()
        {
            var now = DateTime.Now;
            var dueAt = now.AddSeconds(10).TimeOfDay;
            var startDateTime = now;
            var endDateTime = startDateTime.AddDays(30);

            WeeklyScheduleBuilder builder = new WeeklyScheduleBuilder(dueAt, startDateTime, endDateTime);
            builder.ScheduleOnDays(true, false, false, false, false, false, false);
            var ws = builder.CreateWeeklySchedule();

            var nextSunday = GetNextSunday(now);

            Assert.AreEqual(nextSunday.Date.Add(dueAt), ws.DueDateTime);
        }
Ejemplo n.º 3
0
        public void ScheduleForWednesdayAndTuesday()
        {
            var now = DateTime.Now;
            var dueAt = now.AddMinutes(-10).TimeOfDay;
            var startDateTime = GetNextWeekOfTheDay(now, DayOfWeek.Wednesday).Add(now.TimeOfDay);
            var endDateTime = startDateTime.AddDays(30);

            WeeklyScheduleBuilder builder = new WeeklyScheduleBuilder(dueAt, startDateTime, endDateTime);
            builder.ScheduleOnDays(false, false, true, true, false, false, false);
            var ws = builder.CreateWeeklySchedule();

            var due = GetNextWeekOfTheDay(startDateTime, DayOfWeek.Tuesday);

            Assert.AreEqual(due.Date.Add(dueAt), ws.DueDateTime);
        }