public void DateOutsideMinMaxNegated()
 {
     StringDateTimeRangeValidator validator = new StringDateTimeRangeValidator(DateTime.Now, DateTime.Now.AddDays(5), true);
     ValidationResults results = new ValidationResults();
     validator.DoValidate(DateTime.Now.AddDays(10).ToString(validator.StringDateFormat), null, null, results);
     Assert.IsTrue(results.IsValid);
 }
 public void DateIsOutsideBoundary()
 {
     StringDateTimeRangeValidator validator = new StringDateTimeRangeValidator(DateTime.Now);
     ValidationResults results = new ValidationResults();
     validator.DoValidate(DateTime.Now.AddDays(1).ToString(validator.StringDateFormat), null, null, results);
     Assert.IsFalse(results.IsValid);
 }
 public void DateBetweenMinMax()
 {
     StringDateTimeRangeValidator validator = new StringDateTimeRangeValidator(DateTime.Now, DateTime.Now.AddDays(5));
     ValidationResults results = new ValidationResults();
     validator.DoValidate(DateTime.Now.AddDays(3).ToString(validator.StringDateFormat), null, null, results);
     Assert.IsTrue(results.IsValid);
 }
            public void DateFormatIsInvalid()
            {
                StringDateTimeRangeValidator validator = new StringDateTimeRangeValidator(DateTime.Now)
                {
                    StringDateFormat = "yyyy/MM/dd"
                };

                ValidationResults results = new ValidationResults();
                validator.DoValidate(DateTime.Now.AddDays(1).ToString("dd/MM/yyyy"), null, null, results);
                Assert.IsTrue(results.IsValid);
            }
 public void StringIsNull()
 {
     StringDateTimeRangeValidator validator = new StringDateTimeRangeValidator(DateTime.MaxValue);
     ValidationResults results = new ValidationResults();
     validator.DoValidate(null, null, null, results);
     Assert.IsTrue(results.IsValid);
 }