public void Should_be_able_to_satisfy_a_stepped_values() { var field = new CronMonth("5-10/5"); var control = new DateTime(2011, 01, 01, 0, 0, 0); var date = field.GetNext(control); Assert.AreEqual(control.AddMonths(4), date); date = field.GetNext(date.AddMonths(1)); Assert.AreEqual(control.AddMonths(9), date); date = field.GetNext(date.AddMonths(1)); Assert.AreEqual(control.AddMonths(16), date); }
public void Should_be_able_to_satisfy_individual_values() { var field = new CronMonth("2,APR,May,8,oct"); var control = new DateTime(2011, 01, 01, 0, 0, 0); var date = field.GetNext(control); Assert.AreEqual(control.AddMonths(1), date); date = field.GetNext(date.AddMonths(1)); Assert.AreEqual(control.AddMonths(3), date); date = field.GetNext(date.AddMonths(1)); Assert.AreEqual(control.AddMonths(4), date); date = field.GetNext(date.AddMonths(1)); Assert.AreEqual(control.AddMonths(7), date); date = field.GetNext(date.AddMonths(1)); Assert.AreEqual(control.AddMonths(9), date); }
public void Should_be_able_to_satisfy_asterisk_value() { var field = new CronMonth("*"); var date = new DateTime(2011, 01, 01, 0, 0, 0); for (var i = 1; i < 13; i++) { Assert.AreEqual(date, field.GetNext(date)); date = date.AddHours(1); } }