mirror of
https://github.com/Smaug123/unofficial-nunit-runner
synced 2025-10-05 01:18:39 +00:00
32 lines
767 B
Forth
32 lines
767 B
Forth
namespace Consumer
|
|
|
|
open System.Threading
|
|
open FsUnitTyped
|
|
open NUnit.Framework
|
|
|
|
[<RequireQualifiedAccess>]
|
|
module NonStaticTestHelpers =
|
|
let count = ref 0
|
|
|
|
[<TestFixture>]
|
|
type TestNonStatic () =
|
|
let count = ref 0
|
|
|
|
member this.Thing = "i'm a thing"
|
|
|
|
[<Test>]
|
|
member this.Foo () =
|
|
Interlocked.Increment NonStaticTestHelpers.count |> ignore<int>
|
|
Interlocked.Increment count |> ignore<int>
|
|
this.Thing |> shouldEqual "i'm a thing"
|
|
|
|
[<Test>]
|
|
static member AnotherTest () =
|
|
Interlocked.Increment NonStaticTestHelpers.count |> ignore<int>
|
|
1 |> shouldEqual 1
|
|
|
|
[<OneTimeTearDown>]
|
|
member _.TearDown () =
|
|
count.Value |> shouldEqual 1
|
|
NonStaticTestHelpers.count.Value |> shouldEqual 2
|