Unquote:我错过了什么?

Joe*_*ler 3 f# unit-testing f#-unquote

我正在尝试让Unquote库在.NET 4中使用xUnit,而且我没有任何运气可以让测试运行.所以,我把它分解为最简单的再现步骤.有人知道我可能会缺少什么吗?

  1. 创建一个新的F#Library项目.
  2. 使用NuGet添加xUnit和Unquote引用.
  3. 粘贴以下代码......

我直接从Unquote主页获得了实际测试,但内容并不重要,因为它没有运行.

module Tests

open Xunit
open Swensen.Unquote

[<Fact>]
let ``demo Unquote xUnit support`` () =
    test <@ ([3; 2; 1; 0] |> List.map ((+) 1)) = [1 + 3..1 + 0] @>
Run Code Online (Sandbox Code Playgroud)

然后我编译程序集并将其加载到xUnit.net GUI测试运行器(64位,CLR 4)中,并在运行测试时收到以下错误:

Tests.demo Unquote xUnit support : System.MissingMethodException : Method not found:
'Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Quotations.FSharpExpr> Swensen.Unquote.Extensions.Expr.ReduceFully(Microsoft.FSharp.Quotations.FSharpExpr)'.
Stack Trace:
   at Tests.demo Unquote xUnit support()
Run Code Online (Sandbox Code Playgroud)

Joe*_*ler 6

没关系,我想通了.我正在使用VS 11预览版,即使我在我的项目中使用.NET 4.0,该项目也引用了错误版本的FSharp.Core.dll:

C:\ Program Files(x86)\ Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0\FSharp.Core.dll

我把它改为引用这个,一切都开始正常了:

C:\ Program Files(x86)\ Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\FSharp.Core.dll