<PackageReference Include="NUnit" Version="3.4.0" />

ConstraintResult

public class ConstraintResult
Contain the result of matching a Constraint against an actual value.
public object ActualValue { get; }

The actual value that was passed to the ApplyTo<T> method.

public string Description { get; }

Description of the constraint may be affected by the state the constraint had when ApplyTo<T> was performed against the actual value.

public virtual bool IsSuccess { get; }

True if actual value meets the Constraint criteria otherwise false.

public string Name { get; }

Display friendly name of the constraint.

public ConstraintStatus Status { get; set; }

Gets and sets the ResultStatus for this result.

public ConstraintResult(IConstraint constraint, object actualValue)

Constructs a ConstraintResult for a particular Constraint.

public ConstraintResult(IConstraint constraint, object actualValue, ConstraintStatus status)

Constructs a ConstraintResult for a particular Constraint.

public ConstraintResult(IConstraint constraint, object actualValue, bool isSuccess)

Constructs a ConstraintResult for a particular Constraint.

public virtual void WriteActualValueTo(MessageWriter writer)

Write the actual value for a failing constraint test to a MessageWriter. The default implementation simply writes the raw value of actual, leaving it to the writer to perform any formatting.

public virtual void WriteMessageTo(MessageWriter writer)

Write the failure message to the MessageWriter provided as an argument. The default implementation simply passes the result and the actual value to the writer, which then displays the constraint description and the value. Constraints that need to provide additional details, such as where the error occured can override this.