XUnitで構築されたFsUnitを使用して例外をアサートしようとしています。私はFsUnit websiteからこのテストを取った:FsUnitは例外と一致しません - F#
[<Fact>]
let ``boom``() =
(fun() -> failwith "BOOM!" |> ignore) |> should throw typeof<System.Exception>
を私がテストを実行するために、ReSharperの2016を使用していると私は次のエラーを取得する:
FsUnit.Xunit+MatchException
Exception of type 'FsUnit.Xunit+MatchException' was thrown.
Expected: System.Exception
Actual: was [email protected]
at SqlJuxtFunctionalTests.Scenarios.CompareTableScenarios.boom() in C:\projects\SqlJuxt\src\SqlJuxtFunctional.Tests\CompareTableScenarios.fs:line 22
私は関与ライブラリの以下のバージョンを使用しています:
- FSharp.Core:4.0.0.1
- ネット:4.6.2
- FsUnit.Xunit:1.4.1.0
- XUnit.core:2.1.0
私はそう、私は次のテストでのNUnitに基づいてFsUnitを使用するように切り替えてみました、それはxUnitのに問題があるかもしれないと思った。
[<Test>]
let ``boom nunit``() =
(fun() -> failwith "BOOM!" |> ignore) |> should throw typeof<System.Exception>
NUnitのバージョンがMissingMethodException
スロー:私は私の知恵はこれで終わりだと
System.MissingMethodException : Method not found: 'Void FsUnit.TopLevelOperators.should(Microsoft.FSharp.Core.FSharpFunc`2<!!0,!!1>, !!0, System.Object)'.
at File1.boom()
任意の助けをいただければ幸いです。
[この回答](http://stackoverflow.com/questions/36238316/missingmethodexception-when-testing-a-function-that-takes-a-function-parameter/36241071#36241071)もご覧ください。 –