public bool GreaterThanEqualTo_IsValid(int propertyValue, int greaterThanEqualTo) { //Create Validator var validator = new GreaterThanEqualTo <Contact, int>(greaterThanEqualTo); RuleValidatorContext <Contact, int> context = BuildContextForNumberOfDependents(propertyValue); var notification = new ValidationNotification(); //Validate the validator only, return true of no error returned return(validator.Validate(context, null, notification)); }
public bool GreaterThanEqualTo_Expression_IsValid(string propertyValue, string greaterThan) { DateTime propertyValueDateTime = DateTime.Parse(propertyValue); DateTime greaterThanDateTime = DateTime.Parse(greaterThan); //Create Validator var validator = new GreaterThanEqualTo <CalendarEvent, DateTime>(c => c.StartDate); // Build context for CalendarEvent containing a StartDate of propertyValue. RuleValidatorContext <CalendarEvent, DateTime> context = BuildContextForCalendarEventEndDate("Test Event", greaterThanDateTime, propertyValueDateTime); var notification = new ValidationNotification(); //Validate the validator only, return true of no error returned return(validator.Validate(context, null, notification)); }