Пример #1
0
        public void GetDescription_CronYearlyWithMonthDayHourMinute_ReturnsAtFiveFifteenAMDay4OfMarch()
        {
            string expected = "At 05:15 AM, on day 4 of the month, only in March";
            string actual   = Cron.GetDescription(Cron.Yearly(3, 4, 5, 15));

            Assert.Equal(expected, actual);
        }
Пример #2
0
        public void GetDescription_CronYearly_ReturnsYearly()
        {
            string expected = "At 00:00 AM, on day 1 of the month, only in January";
            string actual   = Cron.GetDescription(Cron.Yearly());

            Assert.Equal(expected, actual);
        }
Пример #3
0
        public void GetDescription_CronYearlyWithMonthDay_ReturnsAtMidnightDay4OfMarch()
        {
            string expected = "At 00:00 AM, on day 4 of the month, only in March";
            string actual   = Cron.GetDescription(Cron.Yearly(3, 4));

            Assert.Equal(expected, actual);
        }
Пример #4
0
        public void GetDescription_CronMonthlyWithDay_ReturnsAtMidnightOnDay5()
        {
            string expected = "At 00:00 AM, on day 5 of the month";
            string actual   = Cron.GetDescription(Cron.Monthly(5));

            Assert.Equal(expected, actual);
        }
Пример #5
0
        public void GetDescription_CronMonthlyWithDayHourMinute_ReturnsAtFiveFifteenAMOnDay5()
        {
            string expected = "At 05:15 AM, on day 5 of the month";
            string actual   = Cron.GetDescription(Cron.Monthly(5, 5, 15));

            Assert.Equal(expected, actual);
        }
Пример #6
0
        public void GetDescription_CronWeeklyWithDay_ReturnsAtMidnightOnTuesday()
        {
            string expected = "At 00:00 AM, only on Tuesday";
            string actual   = Cron.GetDescription(Cron.Weekly(DayOfWeek.Tuesday));

            Assert.Equal(expected, actual);
        }
Пример #7
0
        public void GetDescription_CronWeeklyWithDayHourMinute_ReturnsAtFiveFifteenAMOnTuesday()
        {
            string expected = "At 05:15 AM, only on Tuesday";
            string actual   = Cron.GetDescription(Cron.Weekly(DayOfWeek.Tuesday, 5, 15));

            Assert.Equal(expected, actual);
        }
Пример #8
0
        public void GetDescription_CronDailyWithHourMinute_ReturnsAtFiveFifteenAM()
        {
            string expected = "At 05:15 AM";
            string actual   = Cron.GetDescription(Cron.Daily(5, 15));

            Assert.Equal(expected, actual);
        }
Пример #9
0
        public void GetDescription_CronWeekly_ReturnsAtMidnightOnMonday()
        {
            string expected = "At 00:00 AM, only on Monday";
            string actual   = Cron.GetDescription(Cron.Weekly());

            Assert.Equal(expected, actual);
        }
Пример #10
0
        public void GetDescription_CronDaily_ReturnsAtMidnight()
        {
            string expected = "At 00:00 AM";
            string actual   = Cron.GetDescription(Cron.Daily());

            Assert.Equal(expected, actual);
        }
Пример #11
0
        public void GetDescription_CronDailyWithHour_ReturnsAtFiveAM()
        {
            string expected = "At 05:00 AM";
            string actual   = Cron.GetDescription(Cron.Daily(5));

            Assert.Equal(expected, actual);
        }
Пример #12
0
        public void GetDescription_CronHourlyWithMinute_ReturnsFivePasTheHour()
        {
            string expected = "At 05 minutes past the hour";
            string actual   = Cron.GetDescription(Cron.Hourly(5));

            Assert.Equal(expected, actual);
        }
Пример #13
0
        public void GetDescription_CronHourly_ReturnsHourly()
        {
            string expected = "Every hour";
            string actual   = Cron.GetDescription(Cron.Hourly());

            Assert.Equal(expected, actual);
        }
Пример #14
0
        public void GetDescription_CronMinutely_ReturnsMinutely()
        {
            string expected = "Every minute";
            string actual   = Cron.GetDescription(Cron.Minutely());

            Assert.Equal(expected, actual);
        }
Пример #15
0
        private Environment Map(Environment env)
        {
            var results = MongoProvider.Database.Value.GetCollection("hangfire.hash")
                          .AsQueryable()
                          .Where(x => ((string)x["Key"]).StartsWith(string.Format("recurring-job:{0}", env.Name)) && x["Field"] == "Cron")
                          .ToList();

            var desc = results.Select(x => new CronDescription
            {
                Name        = x["Key"].AsString.Split('_')[1],
                Description = Cron.GetDescription((string)x["Value"])
            }).ToArray();

            return(env.CloneWithAutoAndDescriptions(results.Any(), desc));
        }
Пример #16
0
 public void GetDescription_LongCronExpression_ThrowsInvalidCastException()
 {
     Assert.Throws <InvalidCastException>(() => Cron.GetDescription("* * * * * *"));
 }