Class CollectionItemsEqualConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
CollectionItemsEqualConstraint is the abstract base class for all collection constraints that apply some notion of item equality as a part of their operation.
public abstract class CollectionItemsEqualConstraint : CollectionConstraint, IConstraint, IResolveConstraint
- Inheritance
-
CollectionItemsEqualConstraint
- Implements
- Derived
- Inherited Members
Constructors
CollectionItemsEqualConstraint()
Construct an empty CollectionConstraint
protected CollectionItemsEqualConstraint()
CollectionItemsEqualConstraint(object?)
Construct a CollectionConstraint
protected CollectionItemsEqualConstraint(object? arg)
Parameters
arg
object
Properties
IgnoreCase
Flag the constraint to ignore case and return self.
public CollectionItemsEqualConstraint IgnoreCase { get; }
Property Value
IgnoringCase
Get a flag indicating whether the user requested us to ignore case.
protected bool IgnoringCase { get; }
Property Value
UsingExternalComparer
Get a flag indicating whether any external comparers are in use.
protected bool UsingExternalComparer { get; }
Property Value
Methods
ItemsEqual(object?, object?)
Compares two collection members for equality
protected bool ItemsEqual(object? x, object? y)
Parameters
Returns
Tally(IEnumerable)
Return a new CollectionTally for use in making tests
protected CollectionTally Tally(IEnumerable c)
Parameters
c
IEnumerableThe collection to be included in the tally
Returns
Using(IComparer)
Flag the constraint to use the supplied IComparer object.
public CollectionItemsEqualConstraint Using(IComparer comparer)
Parameters
comparer
IComparerThe IComparer object to use.
Returns
Using(IEqualityComparer)
Flag the constraint to use the supplied IEqualityComparer object.
public CollectionItemsEqualConstraint Using(IEqualityComparer comparer)
Parameters
comparer
IEqualityComparerThe IComparer object to use.
Returns
UsingPropertiesComparer()
Enables comparing of instance properties.
public CollectionItemsEqualConstraint UsingPropertiesComparer()
Returns
Remarks
This allows comparing classes that don't implement IEquatable<T> without having to compare each property separately in own code.
Using<T>(IComparer<T>)
Flag the constraint to use the supplied IComparer object.
public CollectionItemsEqualConstraint Using<T>(IComparer<T> comparer)
Parameters
comparer
IComparer<T>The IComparer object to use.
Returns
Type Parameters
T
Using<T>(IEqualityComparer<T>)
Flag the constraint to use the supplied IEqualityComparer object.
public CollectionItemsEqualConstraint Using<T>(IEqualityComparer<T> comparer)
Parameters
comparer
IEqualityComparer<T>The IComparer object to use.
Returns
Type Parameters
T
Using<T>(Comparison<T>)
Flag the constraint to use the supplied Comparison object.
public CollectionItemsEqualConstraint Using<T>(Comparison<T> comparison)
Parameters
comparison
Comparison<T>The Comparison object to use.
Returns
Type Parameters
T
Using<T>(Func<T, T, bool>)
Flag the constraint to use the supplied boolean-returning delegate.
public CollectionItemsEqualConstraint Using<T>(Func<T, T, bool> comparer)
Parameters
Returns
Type Parameters
T