This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 @> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 | |
(* |