/// <summary> /// Initializes a new instance of the <see cref="ValidationError" /> class. /// </summary> /// <param name="brokenRule">The broken rule.</param> /// <exception cref="ArgumentNullException">brokenRule is null</exception> public ValidationError(IValidationRuleMethod brokenRule) { if (brokenRule == null) { throw new ArgumentNullException(nameof(brokenRule)); } this.BrokenRule = brokenRule; }
/// <summary> /// Adds a rule to the list of rules to be enforced. /// </summary> /// <param name="rule">The rule.</param> /// <param name="propertyName">Name of the property.</param> /// <exception cref="ArgumentNullException">rule is null</exception> /// <exception cref="ArgumentException">propertyName cannot be null or whitespace.</exception> public void AddRule(IValidationRuleMethod rule, String propertyName) { if (rule == null) { throw new ArgumentNullException(nameof(rule)); } if (String.IsNullOrWhiteSpace(propertyName)) { throw new ArgumentException("Value cannot be null or white space.", nameof(propertyName)); } List <IValidationRuleMethod> list = GetRulesForProperty(propertyName).List; list.Add(rule); }
/// <summary> /// Adds a rule to the list of rules to be enforced. /// </summary> /// <param name="rule">The rule.</param> /// <param name="propertyName">Name of the property.</param> public void AddRule(IValidationRuleMethod rule, String propertyName) { List <IValidationRuleMethod> list = GetRulesForProperty(propertyName).List; list.Add(rule); }
/// <summary> /// Initializes a new instance of the <see cref="ValidationError"/> class. /// </summary> /// <param name="brokenRule">The broken rule.</param> public ValidationError(IValidationRuleMethod brokenRule) { this.BrokenRule = brokenRule; }