-
Notifications
You must be signed in to change notification settings - Fork 158
DictionaryContainsKeyConstraint
Chris Maddock edited this page Dec 30, 2018
·
2 revisions
DictionaryContainsKeyConstraint is used to test whether a dictionary contains an expected object as a key.
DictionaryContainsKeyConstraint(object)
Contains.Key(object)
Does.ContainKey(object)
Does.Not.ContainKey(object)
...Using(IComparer comparer)
...Using(IEqualityComparer comparer)
...Using<T>(IComparer<T> comparer)
...Using<T>(Comparison<T> comparer)
...Using<T>(Func<T, T, bool> comparer)
...Using<T>(IEqualityComparer<T> comparer)
...Using<TCollectionType, TMemberType>(Func<TCollectionType, TMemberType, bool> comparison)
IDictionary<int, int> idict = new IDictionary<int, string> { { 1, 4 }, { 2, 5 } };
Assert.That(idict, Contains.Key(1));
Assert.That(idict, Does.ContainKey(2));
Assert.That(idict, Does.Not.ContainKey(3));
Assert.That(mydict, Contains.Key(myOwnObject).Using(myComparer));
See also:
Copyright (c) 2018 The NUnit Project - Licensed under CC BY-NC-SA 4.0
-
NUnit
-
Release Notes
-
License
- Getting Started
- Writing Tests
- Running Tests
- Extending NUnit
- Technical Notes
-
Release Notes
- NUnit Xamarin Runners
- VS Test Adapter
- VS Test Generator
- NUnit Analyzers