public void GetValidator()
        {
            const int valueToCompare = 10;
            LessThanValidationAttribute lessThanValidationAttribute = new LessThanValidationAttribute(valueToCompare);

            Assert.IsInstanceOf(typeof(LessThanValidator), lessThanValidationAttribute.GetValidator());

            LessThanValidator lessThanValidator = (LessThanValidator)lessThanValidationAttribute.GetValidator();

            Assert.AreEqual(valueToCompare, lessThanValidator.ValueToCompare);
        }
Пример #2
0
        public void TestLessThanValidationAttribute(double maxValue, bool allowEquals, object input, bool isValid)
        {
            LessThanValidationAttribute att = new LessThanValidationAttribute(maxValue, allowEquals);

            Assert.AreEqual(isValid, string.IsNullOrEmpty(att.Validate(input)), "Expected {0} for maxvalue = {1} and allowEquals={2} and input = {3}", isValid, maxValue, allowEquals, input);
        }