本文整理汇总了C#中Scheduler.RefreshSchedules方法的典型用法代码示例。如果您正苦于以下问题:C# Scheduler.RefreshSchedules方法的具体用法?C# Scheduler.RefreshSchedules怎么用?C# Scheduler.RefreshSchedules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler
的用法示例。
在下文中一共展示了Scheduler.RefreshSchedules方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SchedulerRefreshSchedules
public void SchedulerRefreshSchedules()
{
ScheduleRecord schedule = new ScheduleRecord()
{
ApplicationName = BlueCollarSection.Section.ApplicationName,
Enabled = true,
Id = 1,
Name = "Test",
QueueName = "*",
RepeatType = ScheduleRepeatType.Days,
RepeatValue = 1,
StartOn = DateTime.UtcNow.FloorWithSeconds()
};
ScheduledJobRecord scheduledJob = new ScheduledJobRecord()
{
Data = @"{""SleepDuration"":1000}",
Id = 1,
JobType = JobSerializer.GetTypeName(typeof(TestJob)),
Schedule = schedule,
ScheduleId = 1
};
schedule.ScheduledJobs.Add(scheduledJob);
var transaction = new Mock<IDbTransaction>();
var repository = new Mock<IRepository>();
repository.Setup(r => r.BeginTransaction()).Returns(transaction.Object);
repository.Setup(r => r.GetSchedules(BlueCollarSection.Section.ApplicationName, It.IsAny<IDbTransaction>())).Returns(new ScheduleRecord[] { schedule });
var factory = new Mock<IRepositoryFactory>();
factory.Setup(f => f.Create()).Returns(repository.Object);
var logger = new Mock<ILogger>();
Scheduler scheduler = new Scheduler(1, BlueCollarSection.Section.ApplicationName, QueueNameFilters.Any(), 1, factory.Object, logger.Object);
Assert.AreEqual(0, scheduler.Schedules.Count());
scheduler.RefreshSchedules();
Assert.AreEqual(1, scheduler.Schedules.Count());
}