Пример #1
0
        public void Should_fail_if_the_property_value_is_null()
        {
            ExampleWithStringProperty example = new ExampleWithStringProperty();
             example.StringProperty = null;

             IList<ValidatonError> messages =
            _validator.Validate(new object[1] { example }, new Dictionary<string, IValidationAware>()).Errors;

             Assert.AreEqual(1, messages.Count);
        }
Пример #2
0
        public void Succeed_when_the_property_is_an_email_address()
        {
            ExampleWithStringProperty example = new ExampleWithStringProperty();
             example.StringProperty = "*****@*****.**";

             IList<ValidatonError> messages =
            _validator.Validate(new object[1] { example }, new Dictionary<string, IValidationAware>()).Errors;

             Assert.AreEqual(0, messages.Count);
        }