ValidationRule(Func<TProcessResult, Boolean>, String?, String?, Func<TProcessResult, String>?) Constructor

Definition

Assembly CliInvoke.Core.dll

Initialises a new instance of the ValidationRule<TProcessResult> class.

public ValidationRule(Func<TProcessResult, bool> predicate, string? name = null, string? failureMessage = null, Func<TProcessResult, string>? failureMessageFactory = null)

Parameters

predicate
Func<TProcessResult, Boolean>

The predicate that evaluates to true when the rule passes and false when it fails.

name
String

An optional human-readable name for the rule, used in failure reporting.

failureMessage
String

An optional constant message describing the failure. Ignored when failureMessageFactory is provided.

failureMessageFactory
Func<TProcessResult, String>

An optional factory that produces a result-specific failure message. Takes precedence over failureMessage.