f# - 为什么我不能在 F# 中使用最新版本的 NUnit 和 FsCheck?

标签 f# nunit fscheck

我想使用最新版本的 NUnit、FsCheck 和 F#。
然而,当我指向我的包的最新版本时,我的单元测试没有被发现。

但是,发现了我的基于属性的测试(即 FsCheck)。

我的包裹如下:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="FsCheck" version="2.4.0" targetFramework="net461" />
  <package id="FsCheck.Xunit" version="2.4.0" targetFramework="net461" />
  <package id="FSharp.Core" version="4.0.0.1" targetFramework="net461" />
  <package id="FsUnit" version="2.2.0" targetFramework="net461" />
  <package id="NUnit" version="3.2.1" targetFramework="net461" />
  <package id="xunit.abstractions" version="2.0.0" targetFramework="net461" />
  <package id="xunit.extensibility.core" version="2.1.0" targetFramework="net461" />
  <package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net461" />
  <package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net461" />
</packages>

我的 app.config 如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9999.9999.9999.9999" newVersion="3.2.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

最佳答案

您是否尝试过安装 NUnit3 测试适配器以便 Visual Studio 了解 NUnit?
https://www.nuget.org/packages/NUnit3TestAdapter

可能是因为 Visual Studio 已经知道 XUnit,所以找到了您的 FsCheck 测试。

关于f# - 为什么我不能在 F# 中使用最新版本的 NUnit 和 FsCheck?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37509356/

相关文章:

f# - 如何使用 "If not null Else"设置值?

hash - 在 GetHashCode() 中使用 F# 的哈希函数邪恶?

F#菜鸟: matching command line args

c# - 将 Assert.That(而不是 Assume.That)与 [Theory] ​​一起使用是错误的吗?

f# - 将基于 System.Random 的生成器转换为 FsCheck 生成器

f# - Base62 编码的范围运算符

.net - NUnit 测试在 OpenCover 中失败

f# - FsUnit 不匹配异常 - F#

.net - 如何让 FsCheck 生成尊重 MaxLengthAttribute 的随机字符串?

f# - 生成字符串时Expecto FsCheck获取堆栈溢出异常