Table of Contents

Class CollectionSubsetConstraint

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

CollectionSubsetConstraint is used to determine whether one collection is a subset of another

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

Constructors

CollectionSubsetConstraint(IEnumerable)

Construct a CollectionSubsetConstraint

public CollectionSubsetConstraint(IEnumerable expected)

Parameters

expected IEnumerable

The collection that the actual value is expected to be a subset of

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 constraint is satisfied by a given value.

public override ConstraintResult ApplyTo<TActual>(TActual actual)

Parameters

actual TActual

Returns

ConstraintResult

Type Parameters

TActual

Matches(IEnumerable)

Test whether the actual collection is a subset of the expected collection provided.

protected override bool Matches(IEnumerable actual)

Parameters

actual IEnumerable

Returns

bool

Using<TSubsetType, TSupersetType>(Func<TSubsetType, TSupersetType, bool>)

Flag the constraint to use the supplied predicate function

public CollectionSubsetConstraint Using<TSubsetType, TSupersetType>(Func<TSubsetType, TSupersetType, bool> comparison)

Parameters

comparison Func<TSubsetType, TSupersetType, bool>

The comparison function to use.

Returns

CollectionSubsetConstraint

Self.

Type Parameters

TSubsetType
TSupersetType