Reputation: 61391
I am working with VS 2013
, F#
and NUnit
. It is worth noting I am novice with F#
.
I have added very basic test and when I attach debugger to NUnit
and run it in debug mode breakpoint is being hit however test comes back as not being run.
NUnit
identifies it as test but does not run(assumption) Assert
(can be seen in bottom screenshot).
Test:
module Test
open NUnit.Framework
[<TestFixture>]
type Test() =
[<Test>]
let ConcatinationTest =
Assert.AreEqual(Implementation.Concat("aaa"), "rootaaa")
|> ignore
Implementation:
module Implementation
let Concat(text:string) =
"root"+ text
My expectations must be wrong. Why doesn't it work?
Upvotes: 0
Views: 140
Reputation: 7735
You defined it as a value, but it must be a method:
[<Test>]
static member ConcatinationTest () = ...
(converted a comment into an answer, as per OP's request)
Upvotes: 1
Reputation: 61391
OP here, for those who are wondering this works.
module Test
open NUnit.Framework
[<TestFixture>]
type Test() =
member this.ConcatinationTestData() =
[new TestCaseData("roottext","text"); new TestCaseData("root","")]
[<Test>]
[<TestCaseSource("ConcatinationTestData")>]
static member ConcatinationTest(expected:string, text:string) =
Assert.AreEqual(expected,Implementation.Concat(text))
|> ignore
Debug -> Attach to process -> nunit-agent.exe
Result:
Upvotes: 1