public void Reschedule_UpdateSchedule_Success()
        {
            DateTimeOffset now  = new DateTimeOffset(2013, 6, 1, 12, 0, 0, 0, TimeSpan.Zero);
            DateTimeOffset now2 = new DateTimeOffset(2013, 6, 1, 12, 0, 1, 0, TimeSpan.Zero);
            ScheduledTask <FailableScheduledAction> task = new ScheduledTask <FailableScheduledAction>(Schedule.CreateOneTime(now), new FailableScheduledAction(FailableScheduledAction.DummyAction.Run), true, now, now2);

            Schedule NewSchedule = Schedule.CreateInterval(now, TimeSpan.FromHours(1.0), Weekdays.All);

            task.Reschedule(NewSchedule);
            Assert.AreSame(NewSchedule, task.Schedule);

            task.UpdateSchedule(DateTimeOffset.Now);
        }
        public void Reschedule_UpdateScheduleOneTime_Success()
        {
            DateTimeOffset now  = new DateTimeOffset(2013, 6, 1, 12, 0, 0, 0, TimeSpan.Zero);
            DateTimeOffset now2 = new DateTimeOffset(2013, 6, 1, 12, 0, 1, 0, TimeSpan.Zero);
            ScheduledTask <FailableScheduledAction> task = new ScheduledTask <FailableScheduledAction>(Schedule.CreateOneTime(now), new FailableScheduledAction(FailableScheduledAction.DummyAction.Run), true, now, now2);

            Schedule NewSchedule = Schedule.CreateOneTime(DateTimeOffset.Now.AddDays(1.0));

            task.Reschedule(NewSchedule);
            Assert.AreSame(NewSchedule, task.Schedule);

            task.UpdateSchedule(DateTimeOffset.Now);
            Assert.AreEqual(NewSchedule.ScheduledDateTime.Value, task.NextDueDate);
            Assert.IsNull(task.LastStartTime);
        }
Пример #3
0
        public bool Update(ScheduleInfo scheduleInfo)
        {
            ScheduledTask.UpdateSchedule(new Schedule(scheduleInfo.ScheduleExpression));

            return(true);
        }