public void GetValidator() { const int valueToCompare = 10; GreaterThanValidationAttribute greaterThanValidationAttribute = new GreaterThanValidationAttribute(valueToCompare); Assert.IsInstanceOf(typeof(GreaterThanValidator), greaterThanValidationAttribute.GetValidator()); GreaterThanValidator greaterThanValidator = (GreaterThanValidator)greaterThanValidationAttribute.GetValidator(); Assert.AreEqual(valueToCompare, greaterThanValidator.ValueToCompare); }
public void TestGreaterThanValidationAttribute(double minValue, bool allowEquals, object input, bool isValid) { GreaterThanValidationAttribute att = new GreaterThanValidationAttribute(minValue, allowEquals); Assert.AreEqual(isValid, string.IsNullOrEmpty(att.Validate(input)), "Expected {0} for minvalue = {1} and allowEquals={2} and input = {3}", isValid, minValue, allowEquals, input); }