/// <summary> /// Allows you to specify a custom assertion that validates the <see cref="License"/>. /// </summary> /// <param name="validationChain">The current <see cref="IStartValidationChain"/>.</param> /// <param name="predicate">The predicate to determine of the <see cref="License"/> is valid.</param> /// <param name="failure">The <see cref="IValidationFailure"/> will be returned to the application when the <see cref="ILicenseValidator"/> fails.</param> /// <returns>An instance of <see cref="IStartValidationChain"/>.</returns> public static IValidationChain AssertThat(this IStartValidationChain validationChain, Predicate <License> predicate, IValidationFailure failure) { var validationChainBuilder = (validationChain as ValidationChainBuilder); var validator = validationChainBuilder.StartValidatorChain(); validator.Validate = predicate; validator.FailureResult = failure; return(validationChainBuilder); }
public void AddError(IValidationFailure failure) { this.Errors.Add(failure); }
public ValidationFailure(IValidationFailure failure) : base(failure.ToString()) { this.Failure = failure; }
/// <summary> /// Allows you to specify a custom assertion that validates the <see cref="License"/>. /// </summary> /// <param name="validationChain">The current <see cref="IStartValidationChain"/>.</param> /// <param name="predicate">The predicate to determine of the <see cref="License"/> is valid.</param> /// <param name="failure">The <see cref="IValidationFailure"/> will be returned to the application when the <see cref="ILicenseValidator"/> fails.</param> /// <returns>An instance of <see cref="IStartValidationChain"/>.</returns> public static IValidationChain AssertThat(this IStartValidationChain validationChain, Predicate<License> predicate, IValidationFailure failure) { var validationChainBuilder = (validationChain as ValidationChainBuilder); var validator = validationChainBuilder.StartValidatorChain(); validator.Validate = predicate; validator.FailureResult = failure; return validationChainBuilder; }
public ValidationFailure(IValidationFailure failure, string internalMessage) : base(failure.ToString(), internalMessage) { this.Failure = failure; }