FsUnit 2.1 (NUnit 3.2 を使用) を使用して、F# プロジェクトのテストを作成しています。以下は単純なモジュールです。
namespace Library1
module LibraryFunctions =
let Execute f1 = f1()
let Id x = x
そして、ここに私のテストがあります:
namespace Tests
open FsUnit
open NUnit.Framework
open Library1
[<TestFixture>]
type Tests() =
[<Test>]
// Passes
member x.``LibraryFunctions.Id should return the value``() =
LibraryFunctions.Id 42 |> should equal 42
[<Test>]
// Fails
member x.``LibraryFunctions.Execute should return the result of the function``() =
let f() = 42
LibraryFunctions.Execute f |> should equal 42
2 番目のテストは (NCrunch および ReSharper で) 次のメッセージで失敗します。
System.MissingMethodException : Method not found: '!!0 Library1.LibraryFunctions.Execute(Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,!!0>)'.
テスト対象のモジュールを (別の VS プロジェクトではなく) テストと同じコード ファイルに配置すると、テストは成功します。私の疑いでは、これは NUnit と F#/C# の相互運用性の問題によるものです。もしそうなら、どうすれば解決できますか?