public void remove_obsolete_jobs() { var schedule = new JobSchedule(new[] { new JobStatus(typeof(AJob), DateTime.Today), new JobStatus(typeof(BJob), DateTime.Today), }); schedule.RemoveObsoleteJobs(new Type[] { typeof(AJob), typeof(CJob) }); schedule.Find(typeof(BJob)).Status.ShouldEqual(JobExecutionStatus.Inactive); }
public void remove_obsolete_jobs() { var schedule = new JobSchedule(new[] { new JobStatus(typeof (AJob), DateTime.Today), new JobStatus(typeof (BJob), DateTime.Today), }); schedule.RemoveObsoleteJobs(new Type[]{typeof(AJob), typeof(CJob)}); schedule.Find(typeof (BJob)).Status.ShouldEqual(JobExecutionStatus.Inactive); }
void IScheduledJob.Initialize(DateTimeOffset now, IJobExecutor executor, JobSchedule schedule) { var status = schedule.Find(JobType); LastExecution = status.LastExecution; var next = Scheduler.ScheduleNextTime(now, LastExecution); schedule.Schedule(JobType, next); executor.Schedule(this, next); }
public void SetUp() { theSchedule = new JobSchedule(); theRule = new StubbedScheduleRule(); theRule.ScheduledTimes[now] = next; theExecutor = new StubJobExecutor(); theJob = new ScheduledJob <AJob>(theRule); theLastRun = new JobExecutionRecord(); theSchedule.Find(theJob.JobType) .LastExecution = theLastRun; theJob.As <IScheduledJob>().Initialize(now, theExecutor, theSchedule); }
public void changes_the_jobs_that_are_already_scheduled_correcting_where_necessary() { theSchedule.Find(typeof(CJob)).NextTime.ShouldBe((DateTimeOffset)DateTime.Today.AddHours(3)); theSchedule.Find(typeof(BJob)).NextTime.ShouldBe((DateTimeOffset)DateTime.Today.AddHours(1)); }
public void should_reset_the_new_job_status_time_for_record_keeping() { theSchedule.Find(theJob.JobType) .NextTime.ShouldEqual(next); }