Class DictionaryContainsValueConstraint
DictionaryContainsValueConstraint is used to test whether a dictionary contains an expected object as a value.
Inheritance
DictionaryContainsValueConstraint
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public class DictionaryContainsValueConstraint : CollectionItemsEqualConstraint, IConstraint, IResolveConstraint
Constructors
View SourceDictionaryContainsValueConstraint(object?)
Construct a DictionaryContainsValueConstraint
Declaration
public DictionaryContainsValueConstraint(object? expected)
Parameters
Type | Name | Description |
---|---|---|
object | expected |
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
View SourceExpected
Gets the expected object
Declaration
protected object? Expected { get; }
Property Value
Type | Description |
---|---|
object |
Methods
View SourceMatches(IEnumerable)
Test whether the expected value is contained in the dictionary
Declaration
protected override bool Matches(IEnumerable actual)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | actual |
Returns
Type | Description |
---|---|
bool |
Overrides
View SourceUsing<TActualValueElement, TExpected>(Func<TActualValueElement, TExpected, bool>)
Flag the constraint to use the supplied predicate function
Declaration
public DictionaryContainsValueConstraint Using<TActualValueElement, TExpected>(Func<TActualValueElement, TExpected, bool> comparison)
Parameters
Type | Name | Description |
---|---|---|
Func<TActualValueElement, TExpected, bool> | comparison | The comparison function to use. |
Returns
Type | Description |
---|---|
DictionaryContainsValueConstraint | Self. |
Type Parameters
Name | Description |
---|---|
TActualValueElement | The type of the dictionary's |
TExpected | The type of the expected value. |