EqualConstraint<TExpected> Class

Summary

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.
graph BT Type-->Base0["ExpectedValueConstraint<TExpected>"] Base0-->Base1["Constraint"] click Base1 "/tc-lite/api/TCLite.Constraints/Constraint" Base1-->Base2["object"] Type-.->Interface0["IConstraint"] click Interface0 "/tc-lite/api/TCLite.Constraints/IConstraint" Type-.->Interface1["IResolveConstraint"] click Interface1 "/tc-lite/api/TCLite.Constraints/IResolveConstraint" Type["EqualConstraint<TExpected>"] class Type type-node

Syntax

public class EqualConstraint<TExpected> : ExpectedValueConstraint<TExpected>, IConstraint, 
    IResolveConstraint

Type Parameters

Name Description
TExpected

Constructors

Name Summary
EqualConstraint(TExpected) Initializes a new instance of the EqualConstraint class.

Properties

Name Value Summary
And ConstraintExpression
Returns a ConstraintExpression by appending And to the current constraint.
Inherited from Constraint
Arguments object[]
Arguments provided to this Constraint, for use in formatting the description.
Inherited from Constraint
AsCollection EqualConstraint<TExpected>
Flag the constraint to compare arrays as collections and return self.
Builder ConstraintBuilder
A ConstraintBuilder holding this constraint. If not null the constraint is under construction.
Inherited from Constraint
CaseInsensitive bool
Gets a value indicating whether to compare case insensitive.
ClipStrings bool
Gets a value indicating whether or not to clip strings.
Days EqualConstraint<TExpected>
Causes the tolerance to be interpreted as a TimeSpan in days.
Description string
DisplayName string
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 EqualConstraint<TExpected>
Causes the tolerance to be interpreted as a TimeSpan in hours.
IgnoreCase EqualConstraint<TExpected>
Flag the constraint to ignore case and return self.
Milliseconds EqualConstraint<TExpected>
Causes the tolerance to be interpreted as a TimeSpan in milliseconds.
Minutes EqualConstraint<TExpected>
Causes the tolerance to be interpreted as a TimeSpan in minutes.
NoClip EqualConstraint<TExpected>
Flag the constraint to suppress string clipping and return self.
Or ConstraintExpression
Returns a ConstraintExpression by appending Or to the current constraint.
Inherited from Constraint
Percent EqualConstraint<TExpected>
Switches the .Within() modifier to interpret its tolerance as a percentage that the actual values is allowed to deviate from the expected value.
Seconds EqualConstraint<TExpected>
Causes the tolerance to be interpreted as a TimeSpan in seconds.
Ticks EqualConstraint<TExpected>
Causes the tolerance to be interpreted as a TimeSpan in clock ticks.
Tolerance Tolerance
Gets the tolerance for this comparison.
Ulps EqualConstraint<TExpected>
Switches the .Within() modifier to interpret its tolerance as a distance in representable values (see remarks).
With ConstraintExpression
Returns a ConstraintExpression by appending And to the current constraint.
Inherited from Constraint

Methods

Name Value Summary
ApplyConstraint<T>(ActualValueDelegate<T>) ConstraintResult
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.
Inherited from Constraint
ApplyConstraint<T>(T) ConstraintResult
Test whether the constraint is satisfied by a given value
ApplyConstraint<T>(T) ConstraintResult
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.
Inherited from Constraint
ApplyTo<T>(ActualValueDelegate<T>) ConstraintResult
Validates the ActualValueDelegate and applies the constraint to the value it returns.
Inherited from Constraint
ApplyTo<T>(T) ConstraintResult
Validates the actual value argument and applies the constraint to it, returning a ConstraintResult.
Inherited from Constraint
ApplyTo<T>(T) ConstraintResult
Validates the actual value argument and applies the constraint to it, returning a ConstraintResult.
Inherited from Constraint
GetStringRepresentation() string
Returns the string representation of this constraint
Inherited from Constraint
ToString() string
Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets.
Inherited from Constraint
Using(IComparer) EqualConstraint<TExpected>
Flag the constraint to use the supplied IComparer object.
Using(IEqualityComparer) EqualConstraint<TExpected>
Flag the constraint to use the supplied IEqualityComparer object.
Using<T>(Comparison<T>) EqualConstraint<TExpected>
Flag the constraint to use the supplied Comparison object.
Using<T>(IComparer<T>) EqualConstraint<TExpected>
Flag the constraint to use the supplied IComparer object.
Using<T>(IEqualityComparer<T>) EqualConstraint<TExpected>
Flag the constraint to use the supplied IEqualityComparer object.
ValidateActualValue(object) void
Validate the actual value argument based on what the particular constraint allows. The default implementation does nothing, implying that the constraint can handle any Type as well as null values.
Inherited from Constraint
Within(object) EqualConstraint<TExpected>
Flag the constraint to use a tolerance when determining equality.