f# - FsUnit 示例错误

标签 f# fsunit

我从 FsUnit project page 复制了这个示例:

open NUnit.Framework
open FsUnit
let [<Test>] trivial () = 1 |> should not (equal 2)

F# 给我以下错误:

Error 2 This expression was expected to have type bool but here has type Constraints.EqualConstraint

Error 1 The type 'bool' is not compatible with the type 'Constraints.Constraint'

我做错了什么?

最佳答案

较新版本的 FsUnit 包含将 FsUnit.not 函数重命名为 FsUnit.not' 的更改。这应该消除与内置 not 函数的冲突。您可以从 NuGet Gallery 获取最新版本.使用示例可以在 FsUnit GitHub site 上找到。 .

如果您仍然发现问题,请告诉我。我很乐意与您进行更深入的故障排除。

关于f# - FsUnit 示例错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10902363/

相关文章:

asynchronous - 如何从带有回调的 C# 方法创建 F# 异步?

linux - 如何在 Linux 下调试 F#/Nemerle mono 应用程序?

f# - 如何将从数据库返回的日期与日期(字符串或其他)进行比较?

f# - 测试带有函数参数的函数时出现 MissingMethodException

azure - UserSecretsId 阻止将 F# ASP.NET Core 应用程序部署到 Azure 应用服务

reactjs - Fable.React - 编辑输入字段将光标移动到文本末尾

unit-testing - 如何在 f# 中为模式匹配创建 fsunit 测试?

f# - 如何使用FsUnit检查歧视工会的情况?

f# - FsUnit.Xunit 列表应该包含一个 x 使得 f x