50_ContentsAssertions

Thorsten Lorenz edited this page Nov 29, 2010 · 4 revisions

FSharpSpec Contents Assertions

should.contain, shouldn't.contain when applied to collections

When these assertions are applied to a sequence or anything inheriting from a sequence, they test if, or if not an element is contained in it.

Examples it "1; 2; 3 should.contain 1" 1; 2; 3 should.contain 1 it "1; 2; 3 should.contain 2" 1; 2; 3 should.contain 2 it "1; 2; 3 shouldn't.contain 4" 1; 2; 3 shouldn't.contain 4

should.contain, shouldn't.contain when applied to strings

When these assertions are applied to a string, string functions are used in order to determine if the string contains the expected substring.

Examples let hello = "hello" let hel = "hel" [ it "hello should.contain hel" hello should.contain hel it "hel shouldn't.contain hello" hel shouldn't.contain hello ]