Shouldly
  • Overview
  • Contributing
  • Documentation
    • Getting Started
    • Configuration
    • Equality
      • ShouldBe
      • NotBe
      • Null
      • Bool
      • Flags
      • AssignableTo
      • OfType
      • OneOf
      • Greater/Less Than
      • InRange
      • MatchApproved
      • Enumerable
      • SameAs
      • String
      • ExampleClasses
    • String
      • ShouldBe
      • Match
      • Contain
      • Null and Empty
      • StartWith
      • EndWith
    • Enumerable
      • ShouldBe
      • All
      • Empty
      • OneOf
      • Contain
      • Unique
      • SubsetOf
      • Have
    • Dictionary
      • ContainKey
      • ContainKeyAndValue
    • Exceptions
      • Throw
      • NotThrow
    • SatisfyAllConditions
    • CompleteIn
    • DynamicShould
    • Upgrade 3 to 4
Powered by GitBook
On this page
  • ShouldContainKeyAndValue
  • ShouldNotContainKeyAndValue
Edit on GitHub
  1. Documentation
  2. Dictionary

ContainKeyAndValue

PreviousContainKeyNextExceptions

Last updated 2 years ago

ShouldContainKeyAndValue

var websters = new Dictionary<string, string> { { "Cromulent", "I never heard the word before moving to Springfield." } };
websters.ShouldContainKeyAndValue("Cromulent", "Fine, acceptable.");

|

Exception

websters
    should contain key
"Cromulent"
    with value
"Fine, acceptable."
    but value was
"I never heard the word before moving to Springfield."

ShouldNotContainKeyAndValue

var websters = new Dictionary<string, string> { { "Chazzwazzers", "What Australians would have called a bull frog." } };
websters.ShouldNotContainValueForKey("Chazzwazzers", "What Australians would have called a bull frog.");

|

Exception

websters
    should not contain key
"Chazzwazzers"
    with value
"What Australians would have called a bull frog."
    but does
snippet source
snippet source
anchor
anchor