Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Thorsten Lorenz edited this page · 3 revisions

FSharpSpec Equality Assertions

FSharpSpec comes with lots of built in assertions in form of should and shouldn't functions.

should.equal, shouldn't.equal

These methods test for value equality of two objects - no big surprise there.

If one object is null, no exceptions is thrown, but the test will fail if it was not expected to be null.


    `it "1 + 1 is 2" (1 + 1) should.equal 2`
    `it "1 + 1 is not 3" (1 + 1) shouldn't.equal 2`

should.beSameAs, shouldn't.beSameAs

These methods work like their should.equal counterparts, but test for reference equality of two objects., shouldn't be

These methods have two functions

  1. Test for boolean equality (the same as should.equal for booleans).

    Examples it "true is true" true true it "true is not false" true shouldn' false

  2. Test if a given object has/has not an expected type

    Example it "'r' is a char" 'r' typeof<char>

Something went wrong with that request. Please try again.