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

Constraint

public abstract class Constraint : IConstraint, IResolveConstraint
The Constraint class is the base of all built-in constraints within NUnit. It provides the operator overloads used to combine constraints.
public ConstraintExpression And { get; }

Returns a ConstraintExpression by appending And to the current constraint.

public object[] Arguments { get; }

Arguments provided to this Constraint, for use in formatting the description.

public ConstraintBuilder Builder { get; set; }

The ConstraintBuilder holding this constraint

public virtual string Description { get; protected set; }

The Description of what this constraint tests, for use in messages and in the ConstraintResult.

public virtual string DisplayName { get; }

The display name of this Constraint for use by ToString(). The default value is the name of the constraint with trailing "Constraint" removed. Derived classes may set this to another name in their constructors.

public ConstraintExpression Or { get; }

Returns a ConstraintExpression by appending Or to the current constraint.

public ConstraintExpression With { get; }

Returns a ConstraintExpression by appending And to the current constraint.

protected Constraint(object[] args)

Construct a constraint with optional arguments

public static Constraint op_BitwiseAnd(Constraint left, Constraint right)

This operator creates a constraint that is satisfied only if both argument constraints are satisfied.

public static Constraint op_BitwiseOr(Constraint left, Constraint right)

This operator creates a constraint that is satisfied if either of the argument constraints is satisfied.

public static Constraint op_LogicalNot(Constraint constraint)

This operator creates a constraint that is satisfied if the argument constraint is not satisfied.

public DelayedConstraint After(int delayInMilliseconds)

Returns a DelayedConstraint with the specified delay time.

public DelayedConstraint After(int delayInMilliseconds, int pollingInterval)

Returns a DelayedConstraint with the specified delay time and polling interval.

public abstract ConstraintResult ApplyTo<TActual>(TActual actual)

Applies the constraint to an actual value, returning a ConstraintResult.

public virtual ConstraintResult ApplyTo<TActual>(ActualValueDelegate<TActual> del)

Applies the constraint to an ActualValueDelegate that returns the value to be tested. The default implementation simply evaluates the delegate but derived classes may override it to provide for delayed processing.

public virtual ConstraintResult ApplyTo<TActual>(ref TActual actual)

Test whether the constraint is satisfied by a given reference. The default implementation simply dereferences the value but derived classes may override it to provide for delayed processing.

protected virtual string GetStringRepresentation()

Returns the string representation of this constraint

protected virtual object GetTestObject<TActual>(ActualValueDelegate<TActual> del)

Retrieves the value to be tested from an ActualValueDelegate. The default implementation simply evaluates the delegate but derived classes may override it to provide for delayed processing.