Exemplo n.º 1
0
        public void Creates_correct_lambda_for_validation_type_positive_validation()
        {
            var attr       = new RequiredAttribute();
            var validation = attr.CreateValidation(typeof(decimal));

            Assert.IsNull(validation.Validate("Foo", 1m, new TestViewModel()));
        }
Exemplo n.º 2
0
        public void Creates_correct_lambda_for_validation_type_negative_validation()
        {
            var attr       = new RequiredAttribute();
            var validation = attr.CreateValidation(typeof(int));

            Assert.IsNotNull(validation.Validate("Foo", 0, new TestViewModel()));

            attr       = new RequiredAttribute();
            validation = attr.CreateValidation(typeof(int?));
            Assert.IsNotNull(validation.Validate("Foo", null, new TestViewModel()));
        }