public void TestControlTypes()
        {
            TextControl textControl = new TextControl();
            Assert.AreEqual(ControlType.Text, textControl.Type);

            ComboControl comboControl = new ComboControl();
            Assert.AreEqual(ControlType.Combo, comboControl.Type);

            RadioControl radioControl = new RadioControl();
            Assert.AreEqual(ControlType.Radio, radioControl.Type);

            CheckboxControl checkboxControl = new CheckboxControl();
            Assert.AreEqual(ControlType.Checkbox, checkboxControl.Type);

            CheckboxGroupControl checkboxGroupControl = new CheckboxGroupControl();
            Assert.AreEqual(ControlType.CheckboxGroup, checkboxGroupControl.Type);

            DateControl dateControl = new DateControl();
            Assert.AreEqual(ControlType.Date, dateControl.Type);

            TimeControl timeControl = new TimeControl();
            Assert.AreEqual(ControlType.Time, timeControl.Type);

            FileBrowserControl fileBrowserControl = new FileBrowserControl();
            Assert.AreEqual(ControlType.FileBrowser, fileBrowserControl.Type);

            HiddenControl hiddenControl = new HiddenControl();
            Assert.AreEqual(ControlType.Hidden, hiddenControl.Type);

            LabelControl labelControl = new LabelControl();
            Assert.AreEqual(ControlType.Label, labelControl.Type);

            HtmlControl htmlControl = new HtmlControl();
            Assert.AreEqual(ControlType.Html, htmlControl.Type);

            GroupControl groupControl = new GroupControl();
            Assert.AreEqual(ControlType.Group, groupControl.Type);

            RepeaterControl repeaterControl = new RepeaterControl();
            Assert.AreEqual(ControlType.Repeater, repeaterControl.Type);

            CalculationControl calculationControl = new CalculationControl();
            Assert.AreEqual(ControlType.Calculation, calculationControl.Type);

            SignaturePadControl signaturePadControl = new SignaturePadControl();
            Assert.AreEqual(ControlType.SignaturePad, signaturePadControl.Type);

            GeolocationControl geolocationControl = new GeolocationControl();
            Assert.AreEqual(ControlType.Geolocation, geolocationControl.Type);

            HeadingControl headingControl = new HeadingControl();
            Assert.AreEqual(ControlType.Heading, headingControl.Type);
        }
        public void FormatDateSpecifiedFormat()
        {
            DateControl control = new DateControl();
            ApplicationValueFormatter formatter = new ApplicationValueFormatter { DateFormat = "dd MMM yyyy" };
            string format = formatter.FormatApplicationValue("1982/09/21", control);

            Assert.AreEqual("21 Sep 1982", format);
        }
 public void FormatDateNull()
 {
     DateControl control = new DateControl();
     ApplicationValueFormatter formatter = new ApplicationValueFormatter();
     string format = formatter.FormatApplicationValue(null, control);
     Assert.AreEqual(string.Empty, format);
 }
        public void FormatDateDefaultFormat()
        {
            DateControl control = new DateControl();
            ApplicationValueFormatter formatter = new ApplicationValueFormatter();
            string format = formatter.FormatApplicationValue("1982/09/21", control);

            DateTime dt = new DateTime(1982, 9, 21);
            Assert.AreEqual(dt.ToShortDateString(), format);
        }
 public void FormatString()
 {
     DateControl dateControl = new DateControl { MinimumDateExpression = "1m -1d" };
     Assert.AreEqual(DateTime.Now.Date.AddMonths(1).AddDays(-1), dateControl.MinimumDateValue.Value);
 }
 public void Null()
 {
     DateControl dateControl = new DateControl { MaximumDateExpression = null };
     Assert.IsNull(dateControl.DefaultDateValue);
 }
 public void StaticDate()
 {
     DateControl dateControl = new DateControl { DefaultValueExpression = "25/05/1977" };
     Assert.AreEqual(new DateTime(1977, 5, 25), dateControl.DefaultDateValue.Value);
 }
 public void Numeric()
 {
     DateControl dateControl = new DateControl { DefaultValueExpression = "1" };
     Assert.AreEqual(DateTime.Now.Date.AddDays(1), dateControl.DefaultDateValue.Value);
 }
 public void Empty()
 {
     DateControl dateControl = new DateControl { DefaultValueExpression = string.Empty };
     Assert.IsNull(dateControl.DefaultDateValue);
 }
 /// <summary>
 /// Creates a <see cref="Microsoft.Practices.EnterpriseLibrary.Validation.Validator"/> that will validate
 /// the content for a date control is in the correct range.
 /// </summary>
 /// <param name="dateControl">The control to create a validator for.</param>
 /// <returns>A <see cref="Microsoft.Practices.EnterpriseLibrary.Validation.Validator"/> that will validate
 /// the content for a date control is in the correct range.</returns>
 private Validator CreateValidatorForDateRange(DateControl dateControl)
 {
     DateTime minDate = dateControl.MinimumDateValue ?? DateTime.MinValue;
     DateTime maxDate = dateControl.MaximumDateValue ?? DateTime.MaxValue;
     return new StringDateTimeRangeValidator(minDate, EntLib.RangeBoundaryType.Inclusive, maxDate, EntLib.RangeBoundaryType.Inclusive)
     {
         StringDateFormat = DateControl.SYSTEM_FORMAT,
         MessageTemplate = ValidationMessage.DateTimeRange
     };
 }