public bool IsInSet_GenericList_IsValid(string propertyValue)
 {
     //List
     var list = new List<string> {"US", "GB", "AU", "CA"};
     //Create Validator
     var validator = new Rules.GeneralValidators.IsInSet<Contact,string>(list);
     RuleValidatorContext<Contact, string> context = BuildContextForLength(propertyValue);
     //Validate the validator only, return true of no error returned
     return validator.Validate(context, null) == null;
 }
예제 #2
0
        public bool IsInSet_Expression_GenericList_IsValid(string propertyValue)
        {
            //List
            var list = new List <string> {
                "US", "GB", "AU", "CA"
            };
            //Create Validator
            var validator = new Rules.GeneralValidators.IsInSet <Contact, string>(c => list);
            RuleValidatorContext <Contact, string> context = BuildContextForLength(propertyValue);

            var notification = new ValidationNotification();

            //Validate the validator only, return true of no error returned
            return(validator.Validate(context, null, notification));
        }