public void TimeToEvery30SecShouldBeLessThan30SecAlways() { var schedule = new CronSchedule("0,30 * * * * *"); var remain = schedule.TimeToNextSchedule(_now); Assert.True(remain <= TimeSpan.FromSeconds(30)); remain = schedule.TimeToNextSchedule(DateTime.Now); Assert.True(remain <= TimeSpan.FromSeconds(30)); }
public void NextMonthsCronScheduleShouldBeInGivenSpan() { var span = TimeSpan.FromDays(9 * 31); var next = _now + span; var schedule = new CronSchedule($"{next.Second} {next.Minute} {next.Hour} {next.Day} {next.Month} *"); var time = schedule.TimeToNextSchedule(_now); Assert.Equal((long)span.TotalSeconds, (long)time.TotalSeconds); }