Class DictionaryContainsKeyValuePairConstraint
DictionaryContainsKeyValuePairConstraint is used to test whether a dictionary contains an expected object as a key-value-pair.
Inheritance
DictionaryContainsKeyValuePairConstraint
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public sealed class DictionaryContainsKeyValuePairConstraint : CollectionItemsEqualConstraint, IConstraint, IResolveConstraint
Constructors
View SourceDictionaryContainsKeyValuePairConstraint(object, object?)
Construct a DictionaryContainsKeyValuePairConstraint
Declaration
public DictionaryContainsKeyValuePairConstraint(object key, object? value)
Parameters
Type | Name | Description |
---|---|---|
object | key | |
object | value |
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 constraint is satisfied by a given value
Declaration
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The value to be tested |
Returns
Type | Description |
---|---|
ConstraintResult |
Type Parameters
Name | Description |
---|---|
TActual |
Overrides
View SourceMatches(IEnumerable)
Test whether the expected key is contained in the dictionary
Declaration
protected override bool Matches(IEnumerable collection)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | collection |
Returns
Type | Description |
---|---|
bool |