EqualConstraint Class

Definition

EqualConstraint is able to compare an actual value with the expected value provided in its constructor. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types.

public class EqualConstraint : NUnit.Framework.Constraints.Constraint
type EqualConstraint = class
    inherit Constraint
Inheritance
EqualConstraint

Constructors

EqualConstraint(Object)

Initializes a new instance of the EqualConstraint class.

Fields

actual

The actual value being tested against a constraint

(Inherited from Constraint)

Properties

And

Returns a ConstraintExpression by appending And to the current constraint.

(Inherited from Constraint)
AsCollection

Flag the constraint to compare arrays as collections and return self.

Days

Causes the tolerance to be interpreted as a TimeSpan in days.

DisplayName

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.

(Inherited from Constraint)
Hours

Causes the tolerance to be interpreted as a TimeSpan in hours.

IgnoreCase

Flag the constraint to ignore case and return self.

Milliseconds

Causes the tolerance to be interpreted as a TimeSpan in milliseconds.

Minutes

Causes the tolerance to be interpreted as a TimeSpan in minutes.

NoClip

Flag the constraint to suppress string clipping and return self.

Or

Returns a ConstraintExpression by appending Or to the current constraint.

(Inherited from Constraint)
Percent

Switches the .Within() modifier to interpret its tolerance as a percentage that the actual values is allowed to deviate from the expected value.

Seconds

Causes the tolerance to be interpreted as a TimeSpan in seconds.

Ticks

Causes the tolerance to be interpreted as a TimeSpan in clock ticks.

Ulps

Switches the .Within() modifier to interpret its tolerance as a distance in representable values (see remarks).

With

Returns a ConstraintExpression by appending And to the current constraint.

(Inherited from Constraint)

Methods

After(Int32) (Inherited from Constraint)
After(Int32, Int32) (Inherited from Constraint)
GetStringRepresentation() (Inherited from Constraint)
Matches(Object)

Test whether the constraint is satisfied by a given value

Matches<T>(ActualValueDelegate<T>) (Inherited from Constraint)
Matches<T>(T) (Inherited from Constraint)
ToString()

Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets.

(Inherited from Constraint)
Using(IComparer)

Flag the constraint to use the supplied IComparer object.

Using(IEqualityComparer)

Flag the constraint to use the supplied IEqualityComparer object.

Using<T>(Comparison<T>)

Flag the constraint to use the supplied Comparison object.

Using<T>(IComparer<T>)

Flag the constraint to use the supplied IComparer object.

Using<T>(IEqualityComparer<T>)

Flag the constraint to use the supplied IEqualityComparer object.

Within(Object)

Flag the constraint to use a tolerance when determining equality.

WriteActualValueTo(MessageWriter)

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.

(Inherited from Constraint)
WriteDescriptionTo(MessageWriter)

Write description of this constraint

WriteMessageTo(MessageWriter)

Write a failure message. Overridden to provide custom failure messages for EqualConstraint.

Explicit Interface Implementations

IResolveConstraint.Resolve() (Inherited from Constraint)

Applies to