示例#1
0
        public void is_time_test()
        {
            var cronSchedule = new CronSchedule("0 0 12 10 *");

            Assert.True(cronSchedule.IsTime(DateTime.Parse("12:00:00 am 10/12/2008")));
            Assert.False(cronSchedule.IsTime(DateTime.Parse("12:01:00 am 10/12/2008")));
        }
示例#2
0
        public void is_time_day_of_week_test()
        {
            var cronSchedule = new CronSchedule("* * * * 0");

            Assert.True(cronSchedule.IsTime(DateTime.Parse("10/12/2008")));
            Assert.False(cronSchedule.IsTime(DateTime.Parse("10/13/2008")));

            cronSchedule = new CronSchedule("* * * * */2");
            Assert.True(cronSchedule.IsTime(DateTime.Parse("10/14/2008")));
        }
示例#3
0
        public void is_time_hour_test()
        {
            var cronSchedule = new CronSchedule("* 0 * * *");

            Assert.True(cronSchedule.IsTime(DateTime.Parse("12:00 am")));

            cronSchedule = new CronSchedule("* 0,12 * * *");
            Assert.True(cronSchedule.IsTime(DateTime.Parse("12:00 am")));
            Assert.True(cronSchedule.IsTime(DateTime.Parse("12:00 pm")));
        }
示例#4
0
        public void is_time_month_test()
        {
            var cronSchedule = new CronSchedule("* * * 1 *");

            Assert.True(cronSchedule.IsTime(DateTime.Parse("1/1/2008")));

            cronSchedule = new CronSchedule("* * * 12 *");
            Assert.False(cronSchedule.IsTime(DateTime.Parse("1/1/2008")));

            cronSchedule = new CronSchedule("* * * */3 *");
            Assert.True(cronSchedule.IsTime(DateTime.Parse("3/1/2008")));
            Assert.True(cronSchedule.IsTime(DateTime.Parse("6/1/2008")));
        }
示例#5
0
        public void is_time_minute_test()
        {
            var cronSchedule = new CronSchedule("0 * * * *");

            Assert.True(cronSchedule.IsTime(DateTime.Parse("8:00 am")));
            Assert.False(cronSchedule.IsTime(DateTime.Parse("8:01 am")));

            cronSchedule = new CronSchedule("0-10 * * * *");
            Assert.True(cronSchedule.IsTime(DateTime.Parse("8:00 am")));
            Assert.True(cronSchedule.IsTime(DateTime.Parse("8:03 am")));

            cronSchedule = new CronSchedule("*/2 * * * *");
            Assert.True(cronSchedule.IsTime(DateTime.Parse("8:00 am")));
            Assert.True(cronSchedule.IsTime(DateTime.Parse("8:02 am")));
            Assert.False(cronSchedule.IsTime(DateTime.Parse("8:03 am")));
        }
示例#6
0
        public void is_time_day_of_month_test()
        {
            var cronSchedule = new CronSchedule("* * 1 * *");

            Assert.True(cronSchedule.IsTime(DateTime.Parse("2010/08/01")));
        }