-->

在使用MissingMethodException引文结束断言(MissingMethodExcep

2019-07-05 02:06发布

我试图用所享有与NUnit的为测试运行。 测试用例取自入门和作品时NUnit的外部运行按预期:

namespace FsTest.Tests

open NUnit.Framework
open Swensen.Unquote

[<TestFixture>]
module Example =

    [<Test>]
    let foo() = 
        test <@ (1+2)/3 = 1 @>

在NUnit的我得到这个异常:

未找到方法::FsTest.Tests.Example.foo:system.missingMethodException而“System.Tuple 2<Microsoft.FSharp.Collections.FSharpList 1,Microsoft.FSharp.Quotations.FSharpExpr> Internal.reduceFullyAndGetLast(Microsoft.FSharp.Quotations.FSharpExpr )”。

我想知道,如果有什么不对上面的代码,以及如何我可以使它发挥作用。 引文结束的raise失败,我以同样的方式是否有帮助。

Answer 1:

根据您的问题的描述,我怀疑你需要与配置NUnit的项目FSharp.Core结合从4.0.0.0版本重定向到4.3.0.0版本,因为引文结束的最新版本是专为.NET 4.0和您的测试项目面向.NET 4.5。

见这对细节引文结束问题。 我相信你的配置看起来是这样的

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <legacyUnhandledExceptionPolicy enabled="true" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity
          name="FSharp.Core"
          publicKeyToken="b03f5f7f11d50a3a"
          culture="neutral"/>
        <bindingRedirect
          oldVersion="2.0.0.0"
          newVersion="4.3.0.0"/>
        <bindingRedirect
          oldVersion="4.0.0.0"
          newVersion="4.3.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

我不知道究竟在何处,你需要把这个一个NUnit的项目,但也许通过指定配置文件项目编辑器 ?

不幸的是,我没有安装VS2012,因此我在我的真正诊断这个问题对您有所能力削弱。



文章来源: MissingMethodException when using Unquote asserts