Class NUnitEqualityComparer
NUnitEqualityComparer encapsulates NUnit's handling of equality tests between objects.
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public sealed class NUnitEqualityComparer
Constructors
View SourceNUnitEqualityComparer()
Initializes a new instance of the NUnitEqualityComparer class.
Declaration
public NUnitEqualityComparer()
Properties
View SourceCompareAsCollection
Gets and sets a flag indicating that arrays should be compared as collections, without regard to their shape.
Declaration
public bool CompareAsCollection { get; set; }
Property Value
Type | Description |
---|---|
bool |
CompareProperties
Gets and sets a flag indicating whether an instance properties should be compared when determining equality.
Declaration
public bool CompareProperties { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public IList<EqualityAdapter> ExternalComparers { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
public IList<NUnitEqualityComparer.FailurePoint> FailurePoints { get; }
Property Value
Type | Description |
---|---|
IList<NUnitEqualityComparer.FailurePoint> |
HasFailurePoints
Gets a value indicating whether there is any additional Failure Information.
Declaration
public bool HasFailurePoints { get; }
Property Value
Type | Description |
---|---|
bool |
IgnoreCase
Gets and sets a flag indicating whether case should be ignored in determining equality.
Declaration
public bool IgnoreCase { get; set; }
Property Value
Type | Description |
---|---|
bool |
IgnoreWhiteSpace
Gets and sets a flag indicating whether white space should be ignored in determining equality.
Declaration
public bool IgnoreWhiteSpace { get; set; }
Property Value
Type | Description |
---|---|
bool |
WithSameOffset
Flags the comparer to include Offset property in comparison of two DateTimeOffset values.
Declaration
public bool WithSameOffset { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Using this modifier does not allow to use the Tolerance modifier.
Methods
View SourceAreEqual(object?, object?, ref Tolerance)
Compares two objects for equality within a tolerance.
Declaration
public bool AreEqual(object? x, object? y, ref Tolerance tolerance)
Parameters
Type | Name | Description |
---|---|---|
object | x | |
object | y | |
Tolerance | tolerance |
Returns
Type | Description |
---|---|
bool |