Skip to content

Instantly share code, notes, and snippets.

@mausch
Created September 1, 2014 18:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mausch/8943d1b0f884f88bd8ae to your computer and use it in GitHub Desktop.
Save mausch/8943d1b0f884f88bd8ae to your computer and use it in GitHub Desktop.
#r @"c:\prg\Fuchu\Fuchu\bin\Debug\Fuchu.dll" // https://www.nuget.org/packages/Fuchu/
open System
open Fuchu
// Write your tests as a list of string * Async<unit>
let tests = [
"Check google response", async {
use client = new System.Net.WebClient()
let! a = client.AsyncDownloadString (Uri("http://www.google.com"))
Assert.StringContains("google response", expectedSubString = "Google", actual = a)
}
"Check Bing response", async {
use client = new System.Net.WebClient()
let! a = client.AsyncDownloadString (Uri("http://www.bing.com"))
Assert.StringContains("bing response", expectedSubString = "Microsoft", actual = a)
}
]
// Then run them
tests |> Seq.map (fun (n,a) -> testCase n (fun () -> Async.RunSynchronously a)) |> TestList |> runParallel
@mausch
Copy link
Author

mausch commented Sep 1, 2014

Or try https://github.com/GreanTech/Exude if you insist on using xUnit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment