Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
            }
        }