Skip to content

Instantly share code, notes, and snippets.

@fdcastel
Created April 5, 2016 03:26
Show Gist options
  • Save fdcastel/5235b85b9b9295d16ba54e9d5bd91613 to your computer and use it in GitHub Desktop.
Save fdcastel/5235b85b9b9295d16ba54e9d5bd91613 to your computer and use it in GitHub Desktop.
NUnit tests sample
namespace NUnit.Tests
open NUnit.Framework
[<TestFixture>]
module NUnitTests =
[<TestFixtureSetUp>]
let ``NUnit static member fixture setup``() =
printfn "NUnit static member fixture setup"
[<SetUp>]
let ``NUnit static member setup``() =
printfn "NUnit static member setup"
[<Test>]
let ``NUnit static member test 1``() =
Assert.AreEqual (3, 1 + 2)
[<Test>]
let ``NUnit static member test 2``() =
Assert.AreEqual (4, 2 + 2)
[<TearDown>]
let ``NUnit static member teardown``() =
printfn "NUnit static member teardown"
[<TestFixtureTearDown>]
let ``NUnit static member fixture teardown``() =
printfn "NUnit static member fixture teardown"
[<TestFixture>]
type TestClass() =
[<TestFixtureSetUp>]
member this.``NUnit instance member fixture setup``() =
printfn "NUnit instance member fixture setup"
[<SetUp>]
member this.``NUnit instance member setup``() =
printfn "NUnit instance member setup"
[<Test>]
member this.``NUnit instance member test 1``() =
Assert.AreEqual (3, 1 + 2)
[<Test>]
member this.``NUnit instance member test 2``() =
Assert.AreEqual (4, 2 + 2)
[<TearDown>]
member this.``NUnit instance member teardown``() =
printfn "NUnit instance member teardown"
[<TestFixtureTearDown>]
member this.``NUnit instance member fixture teardown``() =
printfn "NUnit instance member fixture teardown"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment