本文整理汇总了C#中Schedule.ToRunEvery方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.ToRunEvery方法的具体用法?C# Schedule.ToRunEvery怎么用?C# Schedule.ToRunEvery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule.ToRunEvery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_Add_Specified_Minutes_To_Next_Run_Date_When_Is_Between_Specified_Bounds
public void Should_Add_Specified_Minutes_To_Next_Run_Date_When_Is_Between_Specified_Bounds()
{
// Assert
var input = new DateTime(2000, 1, 6, 12, 23, 25);
var expected = new DateTime(2000, 1, 6, 12, 53, 25);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(30).Minutes().Between(10, 00, 16, 00);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例2: Should_Roll_To_Next_Run_Date_Bound_Start_As_After_Bounds
public void Should_Roll_To_Next_Run_Date_Bound_Start_As_After_Bounds()
{
// Arrange
var input = new DateTime(2000, 1, 1, 12, 0, 0);
var expected = new DateTime(2000, 1, 2, 10, 0, 0);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(30).Seconds().Between(10, 0, 11, 0);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例3: Should_Add_Specified_Years_To_Next_Run_Date
public void Should_Add_Specified_Years_To_Next_Run_Date()
{
// Arrange
var input = new DateTime(2000, 1, 1);
var expected = new DateTime(2002, 1, 1);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Years();
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例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()
{
// Assert
var input = new DateTime(2000, 1, 6);
var expected = new DateTime(2000, 3, 5);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Months().On(5);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例5: Should_Override_Existing_Minutes_And_Seconds_If_At_Method_Is_Called
public void Should_Override_Existing_Minutes_And_Seconds_If_At_Method_Is_Called()
{
// Arrange
var input = new DateTime(2000, 1, 1, 1, 23, 25);
var expected = new DateTime(2000, 1, 1, 3, 15, 0);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(1).Days().At(3, 15);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例6: Should_Default_To_00_00_If_At_Is_Not_Defined
public void Should_Default_To_00_00_If_At_Is_Not_Defined()
{
// Arrange
var input = new DateTime(2000, 1, 1, 1, 23, 25);
var expected = new DateTime(2002, 1, 1);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Years();
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例7: Should_Handle_Negative_Numbers
public void Should_Handle_Negative_Numbers()
{
// Arrange
var input = new DateTime(2000, 1, 1);
var expected = new DateTime(2001, 12, 30);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Years().On(-1);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例8: Should_Not_Fail_If_Specified_Day_Does_Not_Exist_In_Year
public void Should_Not_Fail_If_Specified_Day_Does_Not_Exist_In_Year()
{
// Arrange
var input = new DateTime(2000, 1, 1);
var expected = new DateTime(2001, 2, 3);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(1).Years().On(400);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例9: Should_Add_Specified_Seconds_To_Same_Date_Within_Bounds
public void Should_Add_Specified_Seconds_To_Same_Date_Within_Bounds()
{
// Assert
var input = new DateTime(2000, 1, 1, 10, 15, 0);
var expected = new DateTime(2000, 1, 1, 10, 15, 30);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(30).Seconds().Between(10, 0, 11, 0);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例10: 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()
{
// Arrange
var input = new DateTime(2000, 1, 1);
var expected = new DateTime(2000, 12, 31);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Years().OnTheLastDay();
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例11: Should_Pick_Current_Hour_If_Specified_Time_Is_Before_Specified_At_Minutes2
public void Should_Pick_Current_Hour_If_Specified_Time_Is_Before_Specified_At_Minutes2()
{
// Arrange
var input = new DateTime(2000, 1, 1, 5, 14, 25);
var expected = new DateTime(2000, 1, 1, 8, 15, 0);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(3).Hours().At(15);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例12: Should_Not_Schedule_Today_If_Input_Time_Is_After_Run_Time
public void Should_Not_Schedule_Today_If_Input_Time_Is_After_Run_Time()
{
// Arrange
var input = new DateTime(2000, 1, 1, 5, 23, 25);
var expected = new DateTime(2000, 1, 15, 3, 15, 0);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Weeks().At(3, 15);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例13: Should_Default_To_00_00_If_On_Is_Specified_And_At_Is_Not_Defined
public void Should_Default_To_00_00_If_On_Is_Specified_And_At_Is_Not_Defined()
{
// Arrange
var input = new DateTime(2000, 1, 1, 1, 23, 25);
var expected = new DateTime(2000, 1, 15);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Weeks().On(DayOfWeek.Saturday);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例14: Should_Pick_Next_Date_If_Now_Is_After_At_Time
public void Should_Pick_Next_Date_If_Now_Is_After_At_Time()
{
// Arrange
var input = new DateTime(2000, 1, 1, 3, 15, 0).AddMilliseconds(1);
var expected = new DateTime(2000, 1, 4, 3, 15, 0);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(3).Days().At(3, 15);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}
示例15: Should_Delay_Next_Run_Date_Until_Specified_Start
public void Should_Delay_Next_Run_Date_Until_Specified_Start()
{
// Assert
var input = new DateTime(2000, 1, 6, 1, 23, 25);
var expected = new DateTime(2000, 1, 6, 10, 0, 0);
// Act
var schedule = new Schedule(() => { });
schedule.ToRunEvery(2).Minutes().Between(10, 00, 11, 00);
var actual = schedule.CalculateNextRun(input);
// Assert
Assert.AreEqual(expected, actual);
}