Beispiel #1
0
        /// <summary>
        /// Configures the schedule to run a job resolved using a specified closure.
        /// </summary>
        /// <param name="jobCallback">A method to create the <see cref="ICronJob"/> to be executed in the schedule.</param>
        /// <returns>A part that allows chained fluent method calls.</returns>
        public JobPart Run(Func <ICronJob> jobCallback)
        {
            JobExecutionWrapper executionWrapper = (a) =>
            {
                using (var job = jobCallback())
                {
                    a(job);
                }
            };

            var entry = _service.AddScheduledJob(_schedule, executionWrapper);

            return(new JobPart(_service, entry));
        }
Beispiel #2
0
 public Given_a_scheduled_CronJob()
 {
     _sut = new TestCronJob();
     SchedulingService.AddScheduledJob(time => time.AddSeconds(1), (Action <ICronJob> callback) => callback(_sut));
 }