/// <summary> /// Initializes a new instance of the <see cref="And{T}"/> class. /// </summary> /// <param name="rule1">First rule.</param> /// <param name="rule2">Second rule.</param> /// <param name="breakOnFirstError">Value indicating whether rule should break on first error.</param> public And(IPropertyValidationRule <T> rule1, IPropertyValidationRule <T> rule2, bool breakOnFirstError = false) { FirstRule = rule1.AssertArgumentNotNull(nameof(rule1)); LastRule = rule2.AssertArgumentNotNull(nameof(rule2)); Property = rule1.Property; BreakOnFirstError = breakOnFirstError; }
/// <summary> /// Initializes a new instance of the <see cref="OrBuilder{T}"/> class. /// </summary> /// <param name="firstRule">The first rule.</param> public OrBuilder(IPropertyValidationRule <T> firstRule) { FirstRule = firstRule.AssertArgumentNotNull(nameof(firstRule)); }
/// <inheritdoc /> public Or <T> CombineWith(IPropertyValidationRule <T> nextRule) { nextRule.AssertArgumentNotNull(nameof(nextRule)); return(new Or <T>(FirstRule, nextRule)); }
/// <summary> /// Initializes a new instance of the <see cref="AndBuilder{T}"/> class. /// </summary> /// <param name="firstRule">The first rule.</param> /// <param name="breakOnFirstError">Value indicating whether rule should break on first error.</param> public AndBuilder(IPropertyValidationRule <T> firstRule, bool breakOnFirstError = false) { FirstRule = firstRule.AssertArgumentNotNull(nameof(firstRule)); BreakOnFirstError = breakOnFirstError; }
/// <inheritdoc /> public And <T> CombineWith(IPropertyValidationRule <T> nextRule) { nextRule.AssertArgumentNotNull(nameof(nextRule)); return(new And <T>(FirstRule, nextRule, BreakOnFirstError)); }