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

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

            Assert.AreEqual(control.AddDays(4), date);
            date = field.GetNext(date.AddDays(1));

            Assert.AreEqual(control.AddDays(9), date);
            date = field.GetNext(date.AddDays(1));

            Assert.AreEqual(control.AddDays(35), date);
        }
Exemplo n.º 2
0
        public void Should_be_able_to_satisfy_last_weekday()
        {
            var field = new CronDayOfMonth("LW");

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

            Assert.AreEqual(date.AddDays(30), field.GetNext(date));
        }
Exemplo n.º 3
0
        public void Should_be_able_to_satisfy_individual_values()
        {
            var field = new CronDayOfMonth("5,10,15,20");

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

            Assert.AreEqual(control.AddDays(4), date);
            date = field.GetNext(date.AddDays(1));

            Assert.AreEqual(control.AddDays(9), date);
            date = field.GetNext(date.AddDays(1));

            Assert.AreEqual(control.AddDays(14), date);
            date = field.GetNext(date.AddDays(1));

            Assert.AreEqual(control.AddDays(19), date);
            date = field.GetNext(date.AddDays(1));

            Assert.AreEqual(control.AddDays(35), date);
        }
Exemplo n.º 4
0
        public void Should_be_able_to_satisfy_asterisk_value()
        {
            var field = new CronDayOfMonth("*");

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

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

                date = date.AddDays(1);
            }
        }