Table of Contents

Class NUnitEqualityComparer

Namespace
NUnit.Framework.Constraints
Assembly
nunit.framework.dll

NUnitEqualityComparer encapsulates NUnit's handling of equality tests between objects.

public sealed class NUnitEqualityComparer
Inheritance
NUnitEqualityComparer
Inherited Members

Constructors

NUnitEqualityComparer()

Initializes a new instance of the NUnitEqualityComparer class.

public NUnitEqualityComparer()

Properties

CompareAsCollection

Gets and sets a flag indicating that arrays should be compared as collections, without regard to their shape.

public bool CompareAsCollection { get; set; }

Property Value

bool

CompareProperties

Gets and sets a flag indicating whether an instance properties should be compared when determining equality.

public bool CompareProperties { get; set; }

Property Value

bool

ExternalComparers

Gets the list of external comparers to be used to test for equality. They are applied to members of collections, in place of NUnit's own logic.

public IList<EqualityAdapter> ExternalComparers { get; }

Property Value

IList<EqualityAdapter>

FailurePoints

Gets the list of failure points for the last Match performed. The list consists of objects to be interpreted by the caller. This generally means that the caller may only make use of objects it has placed on the list at a particular depth.

public IList<NUnitEqualityComparer.FailurePoint> FailurePoints { get; }

Property Value

IList<NUnitEqualityComparer.FailurePoint>

IgnoreCase

Gets and sets a flag indicating whether case should be ignored in determining equality.

public bool IgnoreCase { get; set; }

Property Value

bool

WithSameOffset

Flags the comparer to include Offset property in comparison of two DateTimeOffset values.

public bool WithSameOffset { get; set; }

Property Value

bool

Remarks

Using this modifier does not allow to use the Tolerance modifier.

Methods

AreEqual(object?, object?, ref Tolerance)

Compares two objects for equality within a tolerance.

public bool AreEqual(object? x, object? y, ref Tolerance tolerance)

Parameters

x object
y object
tolerance Tolerance

Returns

bool