Table of Contents

Class DictionaryContainsValueConstraint

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

DictionaryContainsValueConstraint is used to test whether a dictionary contains an expected object as a value.

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

Constructors

DictionaryContainsValueConstraint(object?)

Construct a DictionaryContainsValueConstraint

public DictionaryContainsValueConstraint(object? expected)

Parameters

expected 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

Expected

Gets the expected object

protected object? Expected { get; }

Property Value

object

Methods

Matches(IEnumerable)

Test whether the expected value is contained in the dictionary

protected override bool Matches(IEnumerable actual)

Parameters

actual IEnumerable

Returns

bool

Using<TCollectionType, TMemberType>(Func<TCollectionType, TMemberType, bool>)

Flag the constraint to use the supplied predicate function

public DictionaryContainsValueConstraint Using<TCollectionType, TMemberType>(Func<TCollectionType, TMemberType, bool> comparison)

Parameters

comparison Func<TCollectionType, TMemberType, bool>

The comparison function to use.

Returns

DictionaryContainsValueConstraint

Self.

Type Parameters

TCollectionType
TMemberType