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
Edit on GitHub
  1. Documentation
  2. Equality

String

PreviousEnumerableNextExampleClasses

Last updated 2 years ago

var target = "Homer";
target.ShouldBe("Bart");

|

Exception

target
    should be
"Bart"
    but was
"Homer"
    difference
Difference     |  |    |    |    |    |   
               | \|/  \|/  \|/  \|/  \|/  
Index          | 0    1    2    3    4    
Expected Value | B    a    r    t         
Actual Value   | H    o    m    e    r    
Expected Code  | 66   97   114  116       
Actual Code    | 72   111  109  101  114  

ShouldNotBe

var target = "Bart";
target.ShouldNotBe("Bart");

Exception

target
    should not be
"Bart"
    but was

|

snippet source
anchor
snippet source
anchor