Converts a Cron Expression into a human readable string
コード例 #1
0
 public void TestTitleCasing()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("* * * * *", new Options() { CasingType = CasingTypeEnum.Title });
     Assert.AreEqual("Every Minute", ceh.GetDescription(DescriptionTypeEnum.FULL));
 }
コード例 #2
0
 public void TestOnceAWeek()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("46 9 * * 1");
     Assert.AreEqual("At 09:46 AM, only on Mondays", ceh.FullDescription);
 }
コード例 #3
0
 public void TestOneMonthOnly()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("* * * 3 *");
     Assert.AreEqual("Every minute, daily, only in March", ceh.FullDescription);
 }
コード例 #4
0
 public void TestMonthName()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("23 12 * JAN *");
     Assert.AreEqual("At 12:23 PM, daily, only in January", ceh.FullDescription);
 }
コード例 #5
0
 public void TestMonthNameRange3()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("23 12 * JAN-MAR *");
     Assert.AreEqual("At 12:23 PM, daily, January-March", ceh.FullDescription);
 }
コード例 #6
0
 public void TestThreeTimesDaily()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("30 6,14,16 * * *");
     Assert.AreEqual("At 06:30 AM, 02:30 PM, and 04:30 PM, daily", ceh.FullDescription);
 }
コード例 #7
0
 public void TestMinuteSpan()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("0-10 11 * * *");
     Assert.AreEqual("Every minute between 11:00 AM and 11:10 AM, daily", ceh.FullDescription);
 }
コード例 #8
0
 public void TestDayOfWeekName()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("23 12 * * SUN");
     Assert.AreEqual("At 12:23 PM, only on Sundays", ceh.FullDescription);
 }
コード例 #9
0
 public void TestDayOfWeekRange()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("*/5 15 * * MON-FRI");
     Assert.AreEqual("Every 5 minutes, at 03:00 PM, Monday-Friday", ceh.FullDescription);
 }
コード例 #10
0
 public void TestDailyAtTime()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("30 11 * * *");
     Assert.AreEqual("At 11:30 AM, daily", ceh.FullDescription);
 }
コード例 #11
0
 public void TestDayOfMonth()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("23 12 15 * *");
     Assert.AreEqual("At 12:23 PM, on day 15 of the month", ceh.FullDescription);
 }
コード例 #12
0
 public void TestWeekdaysAtTime()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("30 11 * * 1-5");
     Assert.AreEqual("At 11:30 AM, Monday-Friday", ceh.FullDescription);
 }
コード例 #13
0
 public void TestTwoTimesEachAfternoon()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("30 14,16 * * *");
     Assert.AreEqual("At 02:30 PM and 04:30 PM, daily", ceh.FullDescription);
 }
コード例 #14
0
 public void TestTwoMonthsOnly()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("* * * 3,6 *");
     Assert.AreEqual("Every minute, daily, only in March and June", ceh.FullDescription);
 }
コード例 #15
0
 public void TestLowerCasing()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("* * * * *", new Options() { CasingType = CasingTypeEnum.LowerCase });
     Assert.AreEqual("every minute", ceh.GetDescription(DescriptionTypeEnum.FULL));
 }
コード例 #16
0
 public void TestEveryMinute()
 {
     ExpressionDescriptor ceh = new ExpressionDescriptor("* * * * *");
     Assert.AreEqual("Every minute, daily", ceh.FullDescription);
 }
コード例 #17
0
 /// <summary>
 /// Generates a human readable string for the Cron Expression  
 /// </summary>
 /// <param name="expression">The cron expression string</param>
 /// <param name="options">Options to control the output description</param>
 /// <returns>The cron expression description</returns>
 public static string GetDescription(string expression, Options options)
 {
     ExpressionDescriptor descripter = new ExpressionDescriptor(expression, options);
     return descripter.GetDescription(DescriptionTypeEnum.FULL);
 }
コード例 #18
0
        /// <summary>
        /// Generates a human readable string for the Cron Expression
        /// </summary>
        /// <param name="expression">The cron expression string</param>
        /// <param name="options">Options to control the output description</param>
        /// <returns>The cron expression description</returns>
        public static string GetDescription(string expression, Options options)
        {
            ExpressionDescriptor descripter = new ExpressionDescriptor(expression, options);

            return(descripter.GetDescription(DescriptionTypeEnum.FULL));
        }