示例#1
0
        public void Test_CharacterValidator_Valid()
        {
            var validator = new DateValidator();
            var value = DateTime.Now.ToString("M/d/yyyy");
            var results = validator.Validate(new PropertyValidatorContext("test", value, value, "value"));

            Assert.IsEmpty(results.ToList());
        }
示例#2
0
        public void Test_DateValidator_NotValid()
        {
            var validator = new DateValidator();
            var value = "fake";
            var results = validator.Validate(new PropertyValidatorContext("test", value, "fake", "value"));

            foreach (var result in results)
            {
                Assert.AreEqual(Errors.DateNotValid, result.ErrorMessage);
            }
        }