本文整理汇总了C#中FluentScheduler.Model.Schedule.CalculateNextRun方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.CalculateNextRun方法的具体用法?C# Schedule.CalculateNextRun怎么用?C# Schedule.CalculateNextRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluentScheduler.Model.Schedule
的用法示例。
在下文中一共展示了Schedule.CalculateNextRun方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
示例2: Should_Add_Specified_Years_To_Next_Run_Date_And_Select_Last_Day_In_That_Year
public void Should_Add_Specified_Years_To_Next_Run_Date_And_Select_Last_Day_In_That_Year()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Years().OnTheLastDay();
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 12, 31);
scheduledTime.Should().Equal(expectedTime);
}
示例3: Should_Add_Specified_Months_To_Next_Run_Date_And_Select_Last_Day_In_That_Month
public void Should_Add_Specified_Months_To_Next_Run_Date_And_Select_Last_Day_In_That_Month()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().OnTheLastDay();
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 1, 31);
Assert.AreEqual(scheduledTime, expectedTime);
}
示例4: 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);
}
示例5: Should_Add_Specified_Years_To_Next_Run_Date
public void Should_Add_Specified_Years_To_Next_Run_Date()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Years();
var input = new DateTime(2000, 1, 1);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2002, 1, 1);
scheduledTime.Should().Equal(expectedTime);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: Should_Handle_Negative_Numbers
public void Should_Handle_Negative_Numbers()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().On(-1);
var input = new DateTime(2000, 1, 1, 1, 23, 25);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 2, 28);
expectedTime.Should().Equal(scheduledTime.Date);
}
示例10: 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);
}
示例11: 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);
}
示例12: Should_Select_The_Date_If_The_Next_Runtime_Falls_On_The_Specified_Day
public void Should_Select_The_Date_If_The_Next_Runtime_Falls_On_The_Specified_Day()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().OnTheLast(DayOfWeek.Friday);
var input = new DateTime(2000, 1, 31);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 3, 31);
Assert.AreEqual(scheduledTime, expectedTime);
}
示例13: Should_Pick_The_Next_Week_If_The_Day_Of_Week_Has_Passed
public void Should_Pick_The_Next_Week_If_The_Day_Of_Week_Has_Passed()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().OnTheSecond(DayOfWeek.Tuesday);
var input = new DateTime(2000, 1, 15);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 3, 14);
Assert.AreEqual(scheduledTime, expectedTime);
}
示例14: Should_Pick_The_Next_Week_If_The_Day_Of_Week_Has_Passed
public void Should_Pick_The_Next_Week_If_The_Day_Of_Week_Has_Passed()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().OnTheFourth(DayOfWeek.Tuesday);
var input = new DateTime(2000, 1, 31);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 3, 28);
scheduledTime.Should().Equal(expectedTime);
}
示例15: Should_Ignore_The_Specified_Day
public void Should_Ignore_The_Specified_Day()
{
var task = new Mock<ITask>();
var schedule = new Schedule(task.Object);
schedule.ToRunEvery(2).Months().OnTheFourth(DayOfWeek.Wednesday);
var input = new DateTime(2000, 3, 23);
var scheduledTime = schedule.CalculateNextRun(input);
var expectedTime = new DateTime(2000, 5, 24);
scheduledTime.Should().Equal(expectedTime);
}