Table of Contents

Class CollectionEquivalentConstraint

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

CollectionEquivalentConstraint is used to determine whether two collections are equivalent.

public class CollectionEquivalentConstraint : CollectionItemsEqualConstraint, IConstraint, IResolveConstraint
Inheritance
CollectionEquivalentConstraint
Implements
Inherited Members

Constructors

CollectionEquivalentConstraint(IEnumerable)

Construct a CollectionEquivalentConstraint

public CollectionEquivalentConstraint(IEnumerable expected)

Parameters

expected IEnumerable

Expected collection.

Properties

Description

The Description of what this constraint tests, for use in messages and in the ConstraintResult.

public override string Description { get; }

Property Value

string

DisplayName

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.

public override string DisplayName { get; }

Property Value

string

Methods

ApplyTo<TActual>(TActual)

Test whether the collection is equivalent to the expected.

public override ConstraintResult ApplyTo<TActual>(TActual actual)

Parameters

actual TActual

Actual collection to compare.

Returns

ConstraintResult

A CollectionEquivalentConstraintResult indicating whether or not the two collections are equivalent.

Type Parameters

TActual

Actual collection type.

Matches(IEnumerable)

protected override bool Matches(IEnumerable actual)

Parameters

actual IEnumerable

Returns

bool

Using<TActual, TExpected>(Func<TActual, TExpected, bool>)

Flag the constraint to use the supplied predicate function

public CollectionEquivalentConstraint Using<TActual, TExpected>(Func<TActual, TExpected, bool> comparison)

Parameters

comparison Func<TActual, TExpected, bool>

The comparison function to use.

Returns

CollectionEquivalentConstraint

Self.

Type Parameters

TActual
TExpected