public void Int16IsNotValid()
        {
            var model = new Int16Model {
                Value1 = 12, Value2 = 120
            };

            Assert.False(model.IsValid("Value2"));
        }
        public void Int16EqualIsValid()
        {
            var model = new Int16Model {
                Value1 = 12, Value2 = 12
            };

            Assert.True(model.IsValid("Value2"));
        }
예제 #3
0
        public void Int16IsValid()
        {
            var model = new Int16Model()
            {
                Value1 = 12, Value2 = 120
            };

            Assert.IsTrue(model.IsValid("Value2"));
        }
예제 #4
0
        public void LessThan_NumericPropertyValueIsNotLessThanDependentValue_Fails()
        {
            var model = new Int16Model()
            {
                Value1 = 12, Value2 = 120
            };

            Assert.IsFalse(model.IsValid("Value2"));
        }
예제 #5
0
        public void LessThan_NumericPropertyValueIsLessThanDependentValue_Validates()
        {
            var model = new Int16Model()
            {
                Value1 = 120, Value2 = 12
            };

            Assert.IsTrue(model.IsValid("Value2"));
        }
        public void GreaterThanOrEqualTo_NumericPropertyValueIsNotGreaterThanOrEqualToDependentValue_Fails()
        {
            var model = new Int16Model()
            {
                Value1 = 120, Value2 = 12
            };

            Assert.IsFalse(model.IsValid("Value2"));
        }
        public void GreaterThanOrEqualTo_NumericPropertyValueIsEqualToDependentValue_Validates()
        {
            var model = new Int16Model()
            {
                Value1 = 12, Value2 = 12
            };

            Assert.IsTrue(model.IsValid("Value2"));
        }
예제 #8
0
        public void Int16IsNotValid()
        {
            var model = new Int16Model()
            {
                Value1 = 120, Value2 = 12
            };

            var ctx     = new ValidationContext(model, null, null);
            var results = new List <ValidationResult>();

            bool actual   = Validator.TryValidateObject(model, ctx, results, true);
            var  expected = false;

            Assert.AreEqual(actual, expected);
        }
        public void Int16IsValid()
        {
            var model = new Int16Model() { Value1 = 12, Value2 = 120 };

            var ctx = new ValidationContext(model, null, null);
            var results = new List<ValidationResult>();

            bool actual = Validator.TryValidateObject(model, ctx, results, true);
            var expected = true;
            Assert.AreEqual(actual, expected);
        }