Esempio n. 1
0
        public void Should_be_able_to_satisfy_a_stepped_values()
        {
            var field = new CronHour("5-10/5");

            var control = new DateTime(2011, 01, 01, 0, 0, 0);
            var date    = field.GetNext(control);

            Assert.AreEqual(control.AddHours(5), date);
            date = field.GetNext(date.AddHours(1));

            Assert.AreEqual(control.AddHours(10), date);
            date = field.GetNext(date.AddHours(1));

            Assert.AreEqual(control.AddHours(29), date);
        }
Esempio n. 2
0
        public void Should_be_able_to_satisfy_individual_values()
        {
            var field = new CronHour("5,10,15,20");

            var control = new DateTime(2011, 01, 01, 0, 0, 0);
            var date    = field.GetNext(control);

            Assert.AreEqual(control.AddHours(5), date);
            date = field.GetNext(date.AddHours(1));

            Assert.AreEqual(control.AddHours(10), date);
            date = field.GetNext(date.AddHours(1));

            Assert.AreEqual(control.AddHours(15), date);
            date = field.GetNext(date.AddHours(1));

            Assert.AreEqual(control.AddHours(20), date);
            date = field.GetNext(date.AddHours(1));

            Assert.AreEqual(control.AddHours(29), date);
        }
Esempio n. 3
0
        public void Should_be_able_to_satisfy_asterisk_value()
        {
            var field = new CronHour("*");

            var date = new DateTime(2011, 01, 01, 0, 0, 0);

            for (var i = 0; i < 24; i++)
            {
                Assert.AreEqual(date, field.GetNext(date));

                date = date.AddHours(1);
            }
        }