public void TestEmptyConstructor()
        {
            // Send in a null.
            CronSpecification cs = new CronSpecification(null);
            Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));

            // Send in an empty string
            cs = new CronSpecification("");
            Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));

            // Use the default constructor
            cs = new CronSpecification();
            Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));
        }
        /// <summary>
        /// Signal handler for ContextChanged event.
        /// </summary>
        /// <param name="contextName">
        /// The name of the data context that changed.
        /// </param>
        /// <param name="itemName">
        /// The name of the item in the data context that changed.
        /// </param>
        private void ContextChangeHandler(string contextName, string itemName)
        {
            log.DebugFormat("ContextChangeHandler({0}, {1})", contextName, itemName);

            // Called when the contents of a context has changed.
            if ("DialogContext".Equals(contextName))
            {
                Domain domain = GetContext("DialogContext").GetDomain("DynamicProperty");
                // Load the Effective Value list control
                evListCtl.Populate(domain);

                evListCtl.DynamicProperty = domain;
            }
            else if ("ValueCriteriaCtx".Equals(contextName))
            {
                Domain domain = GetContext("ValueCriteriaCtx").GetDomain("ValueCriteria");

                string rawCriteria = (string) domain.GetValue("RawCriteria");
                if (rawCriteria == null || rawCriteria.Length == 0)
                {
                    rawCriteria = "* * * * *";
                }

                // Here is where we set up the cron editor; we always
                // do this when a new ValueCriteria is set up.
                CronSpecification cs = new CronSpecification(rawCriteria);

                tvMinutes.SpecificationList = cs.Minutes;
                tvHours.SpecificationList = cs.Hours;
                tvDays.SpecificationList = cs.Days;
                tvMonths.SpecificationList = cs.Months;
                tvDaysOfWeek.SpecificationList = cs.DaysOfWeek;
            }
        }
        /// <summary>
        /// Signal handler for a change in the month cron editor control.
        /// </summary>
        /// <param name="sender">
        /// The month cron editor control
        /// </param>
        /// <param name="e">
        /// The event arguments.
        /// </param>
        protected virtual void MonthsEditorChanged(object sender, System.EventArgs e)
        {
            ArrayList spec = tvMonths.SpecificationList;

            string rawCriteria = txtCriteria.Text;
            CronSpecification cs = new CronSpecification(rawCriteria);

            cs.Months = spec;

            txtCriteria.Text = cs.ToString();

            evListCtl.UpdateSelected();
        }
 public void TestIsFullSpecEffective()
 {
     CronSpecification cs = new CronSpecification(FULL_SPEC);
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));
 }
 public void TestIsDOWFourDateEffective()
 {
     CronSpecification cs = new CronSpecification(DOW_FOUR);
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));
 }
 public void TestIsDayOneDateEffective()
 {
     CronSpecification cs = new CronSpecification(DAY_ONE);
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));
 }
 public void TestHourlyShortcut()
 {
     CronSpecification cs = new CronSpecification("@hourly");
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(MAY_24_2009_MIDNIGHT)));
 }
 public void TestGetRawSpecification()
 {
     CronSpecification cs = new CronSpecification(MINUTE_ONE);
     Assert.AreEqual(MINUTE_ONE, cs.RawSpecification);
 }
 public void TestAnnuallyShortcut()
 {
     CronSpecification cs = new CronSpecification("@annually");
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009_MIDNIGHT)));
 }
 public void IsFullWrongSpecNotEffective()
 {
     CronSpecification cs = new CronSpecification(FULL_WRONG_SPEC);
     Assert.IsFalse(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));
 }
 public void TestIsValidComboEffective()
 {
     CronSpecification cs = new CronSpecification(VALID_COMBO);
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(MARCH_3_2009)));
 }
 public void TestIsValidAllStepsEffective()
 {
     CronSpecification cs = new CronSpecification(VALID_ALL_STEPS);
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(MARCH_3_2009)));
 }
 public void TestIsValidAllRangesEffective()
 {
     CronSpecification cs = new CronSpecification(VALID_ALL_RANGES);
     Assert.IsTrue(cs.IsDateEffective(ConvertDate(JANUARY_1_2009)));
 }