Table of Contents

Class DictionaryContainsKeyValuePairConstraint

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

DictionaryContainsKeyValuePairConstraint is used to test whether a dictionary contains an expected object as a key-value-pair.

public sealed class DictionaryContainsKeyValuePairConstraint : CollectionItemsEqualConstraint, IConstraint, IResolveConstraint
Inheritance
DictionaryContainsKeyValuePairConstraint
Implements
Inherited Members

Constructors

DictionaryContainsKeyValuePairConstraint(object, object)

Construct a DictionaryContainsKeyValuePairConstraint

public DictionaryContainsKeyValuePairConstraint(object key, object value)

Parameters

key object
value object

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

The value to be tested

Returns

ConstraintResult

Type Parameters

TActual

Matches(IEnumerable)

Test whether the expected key is contained in the dictionary

protected override bool Matches(IEnumerable collection)

Parameters

collection IEnumerable

Returns

bool