コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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));
 }
コード例 #6
0
 public void should_reset_the_new_job_status_time_for_record_keeping()
 {
     theSchedule.Find(theJob.JobType)
     .NextTime.ShouldEqual(next);
 }