Class CollectionEquivalentConstraint
CollectionEquivalentConstraint is used to determine whether two collections are equivalent.
Inheritance
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public class CollectionEquivalentConstraint : CollectionItemsEqualConstraint, IConstraint, IResolveConstraint
Constructors
View SourceCollectionEquivalentConstraint(IEnumerable)
Construct a CollectionEquivalentConstraint
Declaration
public CollectionEquivalentConstraint(IEnumerable expected)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | expected | Expected collection. |
Properties
View SourceDescription
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
Declaration
public override string Description { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
View SourceDisplayName
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.
Declaration
public override string DisplayName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
View SourceApplyTo<TActual>(TActual)
Test whether the collection is equivalent to the expected.
Declaration
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | Actual collection to compare. |
Returns
Type | Description |
---|---|
ConstraintResult | A CollectionEquivalentConstraintResult indicating whether or not the two collections are equivalent. |
Type Parameters
Name | Description |
---|---|
TActual | Actual collection type. |
Overrides
View SourceMatches(IEnumerable)
Protected method to be implemented by derived classes
Declaration
protected override bool Matches(IEnumerable actual)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | actual |
Returns
Type | Description |
---|---|
bool |
Overrides
View SourceUsing<TActualElement, TExpectedElement>(Func<TActualElement, TExpectedElement, bool>)
Flag the constraint to use the supplied predicate function
Declaration
public CollectionEquivalentConstraint Using<TActualElement, TExpectedElement>(Func<TActualElement, TExpectedElement, bool> comparison)
Parameters
Type | Name | Description |
---|---|---|
Func<TActualElement, TExpectedElement, bool> | comparison | The comparison function to use. |
Returns
Type | Description |
---|---|
CollectionEquivalentConstraint | Self. |
Type Parameters
Name | Description |
---|---|
TActualElement | The type of the elements in the actual value. |
TExpectedElement | The type of the elements in the expected value. |