Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Swensen stephen-swensen

View GitHub Profile
View gist:2919920
//Unquote (http://code.google.com/p/unquote/) solution to http://stackoverflow.com/questions/11002754/list-member-equality-in-fsunit.
//The following example is shown in FSI, but unquote works configuration free with NUnit, xUnit.net, and all other exception-based unit testing frameworks.
#r @"C:\Unquote.dll"
open Swensen.Unquote
let x = [1;5;3;1;2;4]
let y = [4;3;5;2;1]
test <@ List.sort x = List.sort y @>
@stephen-swensen
stephen-swensen / gist:2366849
Created Apr 12, 2012
Demonstrate asserting a function returns Some using Unquote
View gist:2366849
//here is the function we'd like to test
let testedFunc() = None:option<int>
//here is our Unquote assertion function (using xUnit.net, but can use any unit testing framework such as NUnit)
[<Fact>]
let ``tested func does not return None`` () =
test <@ testedFunc() |> Option.isSome @>
//here is the output from the failing assertion
(*