public void CanValidate () { DefaultValidator v = new DefaultValidator (); Assert.IsTrue (v.CanValidate (typeof (string))); Assert.IsTrue (v.CanValidate (typeof (int))); Assert.IsTrue (v.CanValidate (typeof (object))); }
public void Validate () { DefaultValidator v = new DefaultValidator (); v.Validate (5); v.Validate (5.4); v.Validate ("hi there"); v.Validate (v); }
private static ConfigurationValidatorBase GetValidator(MemberInfo mi) { ConfigurationValidatorBase validator = new DefaultValidator(); var validators = mi.GetAttributes<ValidationAttribute>(); if (validators.IsNullOrEmpty() == false) { validator = new CompositeConfigurationValidator(validators, mi.Name); } return validator; }