public ValidateOp DeepCloneWithValidationChain(ValidationChain validationChain) { var result = new ValidateOp( validationChain); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="ValidateOp"/> class. /// </summary> /// <param name="validationChain">A series of steps that determine the validity of the subject.</param> public ValidateOp( ValidationChain validationChain) { if (validationChain == null) { throw new ArgumentNullException(nameof(validationChain)); } this.ValidationChain = validationChain; }
/// <summary> /// Builds a <see cref="ValidateOp"/>. /// </summary> /// <param name="steps">The individual validation steps/checks.</param> /// <param name="endMessageOp">OPTIONAL operation to execute to get the message that should be emitted when all <paramref name="steps"/> have been evaluated and none have stopped the validation (we've reached the end of the chain). DEFAULT is to omit this message.</param> /// <param name="endValidity">OPTIONAL value that specifies the validity of the subject when all <paramref name="steps"/> have been evaluated and none have stopped the validation (we've reached the end of the chain). DEFAULT is to determine that the subject is valid.</param> /// <returns> /// The operation. /// </returns> public static ValidateOp Validate( this IReadOnlyList <ValidationStep> steps, IReturningOperation <string> endMessageOp = null, Validity endValidity = Validity.Valid) { var validationChain = new ValidationChain(steps, endMessageOp, endValidity); var result = new ValidateOp(validationChain); return(result); }