我正在尝试创建一个在.net核心中运行的F#单元测试项目.
dotnet new -t xunittest
Run Code Online (Sandbox Code Playgroud)
将为C#创建一个xunit测试项目,但F#不存在这样的等价物.
我尝试修改了从上面显示的C#"dotnet new"输出的project.json和test文件,并添加了我认为需要使用F#运行的位.它没用.它在键入"dotnet test"后构建甚至"运行"测试,但测试总是通过,即使它不应该.
我是否遗漏了设置,或者是否有另一个(可能是完全不同的)选项,我可以创建一个F#测试项目?同样,我特别专注于使其与.net核心一起工作.
project.json
{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true,
    "compilerName": "fsc",
    "compile": {
      "includeFiles": [
        "Tests.fs"
      ]
    }
  },
  "dependencies": {
    "System.Runtime.Serialization.Primitives": "4.3.0",
    "xunit": "2.1.0",
    "dotnet-test-xunit": "1.0.0-*"
  },
  "tools": {
    "dotnet-compile-fsc": "1.0.0-preview2.1-*"
  },
  "testRunner": "xunit",
  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.1.0"
        },
        "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160629"
      },
      "imports": [
        "dotnet5.4",
        "portable-net451+win8"
      ]
    }
  }
}
Run Code Online (Sandbox Code Playgroud)
Tests.fs
module Tests
open Xunit
    [<Fact>]
    let ``Should Fail`` = …Run Code Online (Sandbox Code Playgroud)