本文整理汇总了C#中FluentScheduler.Model.Schedule类的典型用法代码示例。如果您正苦于以下问题:C# Schedule类的具体用法?C# Schedule怎么用?C# Schedule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Schedule类属于FluentScheduler.Model命名空间,在下文中一共展示了Schedule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Should_Not_Alter_Original_Runtime_If_Chained_Task_Exists
public void Should_Not_Alter_Original_Runtime_If_Chained_Task_Exists()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunNow().AndEvery(1).Months();
Assert.IsNull(schedule.CalculateNextRun);
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:7,代码来源:SpecificRunTimeTests.cs
示例2: SecondUnit
public SecondUnit(Schedule schedule, int duration)
{
Schedule = schedule;
Duration = duration;
Schedule.CalculateNextRun = x => x.AddSeconds(Duration);
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:7,代码来源:SecondUnit.cs
示例3: MinuteUnit
public MinuteUnit(Schedule schedule, int duration)
{
Schedule = schedule;
Duration = duration;
Schedule.CalculateNextRun = x => x.AddMinutes(Duration);
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:7,代码来源:MinuteUnit.cs
示例4: Should_Add_Chained_Tasks_To_AdditionalSchedules_Property
public void Should_Add_Chained_Tasks_To_AdditionalSchedules_Property()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunNow().AndEvery(1).Months();
Assert.AreEqual(schedule.AdditionalSchedules.Count, 1);
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:7,代码来源:SpecificRunTimeTests.cs
示例5: Should_Be_True_By_Default
public void Should_Be_True_By_Default()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunNow();
schedule.Reentrant.Should().Be.True();
}
开发者ID:vinaysingri,项目名称:FluentScheduler,代码行数:8,代码来源:NonReentrantTests.cs
示例6: MonthOnLastDayOfMonthUnit
public MonthOnLastDayOfMonthUnit(Schedule schedule, int duration)
{
Schedule = schedule;
Duration = duration;
Schedule.CalculateNextRun = x => {
var nextRun = x.Date.Last();
return (x > nextRun) ? x.Date.First().AddMonths(Duration).Last() : x.Date.Last();
};
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:9,代码来源:MonthOnLastDayOfMonthUnit.cs
示例7: YearOnLastDayOfYearUnit
public YearOnLastDayOfYearUnit(Schedule schedule, int duration)
{
Schedule = schedule;
Duration = duration;
Schedule.CalculateNextRun = x => {
var nextRun = x.Date.FirstOfYear().AddMonths(11).Last();
return (x > nextRun) ? x.Date.FirstOfYear().AddYears(Duration).AddMonths(11).Last() : nextRun;
};
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:9,代码来源:YearOnLastDayOfYearUnit.cs
示例8: YearUnit
public YearUnit(Schedule schedule, int duration)
{
Schedule = schedule;
Duration = duration;
Schedule.CalculateNextRun = x => {
var nextRun = x.Date.AddYears(Duration);
return (x > nextRun) ? nextRun.AddYears(Duration) : nextRun;
};
}
开发者ID:mjack121,项目名称:FluentScheduler,代码行数:9,代码来源:YearUnit.cs
示例9: YearOnDayOfYearUnit
public YearOnDayOfYearUnit(Schedule schedule, int duration, int dayOfYear)
{
Schedule = schedule;
Duration = duration;
DayOfYear = dayOfYear;
Schedule.CalculateNextRun = x => {
var nextRun = x.Date.FirstOfYear().AddDays(DayOfYear - 1);
return (x > nextRun) ? x.Date.FirstOfYear().AddYears(Duration).AddDays(DayOfYear - 1) : nextRun;
};
}
开发者ID:rsjyh,项目名称:FluentScheduler,代码行数:10,代码来源:YearOnDayOfYearUnit.cs
示例10: Should_Add_Specified_Days_To_Next_Run_Date
public void Should_Add_Specified_Days_To_Next_Run_Date()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(1).Days();
var input = new DateTime(2000, 1, 1, 1, 23, 25);
var scheduledTime = schedule.CalculateNextRun(input);
Assert.AreEqual(scheduledTime, input.Date.AddDays(1));
}
开发者ID:njmube,项目名称:FluentScheduler,代码行数:10,代码来源:DaysTests.cs
示例11: MonthOnDayOfMonthUnit
public MonthOnDayOfMonthUnit(Schedule schedule, int duration, int dayOfMonth)
{
Schedule = schedule;
Duration = duration;
DayOfMonth = dayOfMonth;
Schedule.CalculateNextRun = x => {
var nextRun = x.Date.First().AddDays(DayOfMonth - 1);
return (x > nextRun) ? x.Date.First().AddMonths(Duration).AddDays(DayOfMonth - 1) : nextRun;
};
}
开发者ID:rsjyh,项目名称:FluentScheduler,代码行数:10,代码来源:MonthOnDayOfMonthUnit.cs
示例12: Should_Add_Specified_Months_To_Next_Run_Date_And_Select_Specified_Day
public void Should_Add_Specified_Months_To_Next_Run_Date_And_Select_Specified_Day()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().On(5);
var input = new DateTime(2000, 1, 6);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 3, 5);
scheduledTime.Should().Equal(expectedTime);
}
开发者ID:vinaysingri,项目名称:FluentScheduler,代码行数:11,代码来源:MonthsOnTests.cs
示例13: Should_Remove_Named_Task
public void Should_Remove_Named_Task()
{
var task = new Mock<ITask>();
var name = "ShouldRemoveTask";
var schedule = new Schedule(task.Object).WithName(name);
schedule.ToRunNow().AndEvery(1).Seconds();
TaskManager.RemoveTask(name);
var taskFromManager = TaskManager.GetSchedule(name);
Assert.IsNull(taskFromManager);
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:11,代码来源:RemoveTests.cs
示例14: Should_Not_Fail_If_Specified_Day_Does_Not_Exist_In_Year
public void Should_Not_Fail_If_Specified_Day_Does_Not_Exist_In_Year()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(1).Years().On(400);
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2001, 2, 3);
Assert.AreEqual(scheduledTime, expectedTime);
}
开发者ID:njmube,项目名称:FluentScheduler,代码行数:11,代码来源:YearsOnTests.cs
示例15: WeekUnit
public WeekUnit(Schedule schedule, int duration)
{
Schedule = schedule;
Duration = duration;
if (Duration < 0)
Duration = 0;
Schedule.CalculateNextRun = x => {
var nextRun = x.Date.AddDays(Duration * 7);
return (x > nextRun) ? nextRun.AddDays(Math.Max(Duration, 1) * 7) : nextRun;
};
}
开发者ID:rsjyh,项目名称:FluentScheduler,代码行数:11,代码来源:WeekUnit.cs
示例16: Should_Add_Specified_Years_To_Next_Run_Date_And_Select_Specified_Day
public void Should_Add_Specified_Years_To_Next_Run_Date_And_Select_Specified_Day()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Years().On(5);
var input = new DateTime(2000, 2, 15);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2002, 1, 5);
Assert.AreEqual(scheduledTime, expectedTime);
}
开发者ID:njmube,项目名称:FluentScheduler,代码行数:11,代码来源:YearsOnTests.cs
示例17: Should_Handle_Negative_Numbers
public void Should_Handle_Negative_Numbers()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Years().On(-1);
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2001, 12, 30);
Assert.AreEqual(scheduledTime.Date, expectedTime);
}
开发者ID:njmube,项目名称:FluentScheduler,代码行数:11,代码来源:YearsOnTests.cs
示例18: Should_Not_Fail_If_Specified_Day_Does_Not_Exist_In_Month
public void Should_Not_Fail_If_Specified_Day_Does_Not_Exist_In_Month()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(1).Months().On(31);
var input = new DateTime(2000, 2, 1, 1, 23, 25);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 3, 2);
scheduledTime.Should().Equal(expectedTime);
}
开发者ID:vinaysingri,项目名称:FluentScheduler,代码行数:11,代码来源:MonthsOnTests.cs
示例19: Should_Add_Specified_Weeks_To_Next_Run_Date
public void Should_Add_Specified_Weeks_To_Next_Run_Date()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Weeks();
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 1, 15);
Assert.AreEqual(scheduledTime, expectedTime);
}
开发者ID:rooseveltdossantos,项目名称:FluentScheduler,代码行数:11,代码来源:WeeksTests.cs
示例20: Should_Set_Chained_Task_Schedule_As_Expected
public void Should_Set_Chained_Task_Schedule_As_Expected()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunNow().AndEvery(2).Months();
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.AdditionalSchedules.ElementAt(0).CalculateNextRun(input);
var expectedTime = new DateTime(2000, 3, 1);
scheduledTime.Should().Equal(expectedTime);
}
开发者ID:vinaysingri,项目名称:FluentScheduler,代码行数:11,代码来源:SpecificRunTimeTests.cs
注:本文中的FluentScheduler.Model.Schedule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论