<PackageReference Include="NUnit" Version="3.6.0" />

DictionaryContainsValueConstraint

DictionaryContainsValueConstraint is used to test whether a dictionary contains an expected object as a value.
using System; using System.Collections; namespace NUnit.Framework.Constraints { public class DictionaryContainsValueConstraint : CollectionContainsConstraint { public override string DisplayName => "ContainsValue"; public override string Description => "dictionary containing value " + MsgUtils.FormatValue(base.Expected); public DictionaryContainsValueConstraint(object expected) : base(expected) { } protected override bool Matches(IEnumerable actual) { IDictionary dictionary = actual as IDictionary; if (dictionary == null) throw new ArgumentException("The actual value must be an IDictionary", "actual"); return base.Matches((IEnumerable)dictionary.Values); } } }