Ejemplo n.º 1
0
        public void ValidateIsTimeFixedValue()
        {
            var scheduler = new CronScheduler("0");

            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:00:10")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 12:01:10")));

            scheduler = new CronScheduler("19 * * 9 *");
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:19:10")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 12:01:10")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-10-05 12:19:10")));
        }
Ejemplo n.º 2
0
        public void ValidateIsTimeListValue()
        {
            var scheduler = new CronScheduler("* 12,13,14 * * *");

            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:45:00")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:55:55")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 13:45:40")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 14:15:33")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 14:32:34")));

            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 00:00")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 08:00:59")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 15:00:00")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 23:59:59")));
        }
Ejemplo n.º 3
0
        public void ValidateIsTimeDividedValue()
        {
            var scheduler = new CronScheduler("*/5");

            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:45:45")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:00:34")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:30:59")));
            Assert.True(scheduler.IsTime(DateTime.Parse("2020-09-05 12:55:00")));

            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 12:01:00")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 12:59:45")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 12:59:59")));
            Assert.False(scheduler.IsTime(DateTime.Parse("2020-09-05 12:31:50")));
        }