I am trying to create a F # unit test project that works in the .net core.
dotnet new -t xunittest
will create a xunit validation project for C #, but such an equivalent does not exist for F #.
I tried modifying project.json and the test file, which is derived from C # "dotnet new", shown above, and adding bits that I thought were necessary to make it work with F #. This did not work. It builds and even “launches” the test after entering the “dotnet test”, but the test ALWAYS passes, even if it should not.
Am I missing something with the setup, or is there another (possibly completely different) option that I can pursue in order to create a F # test project? Again, I'm specifically focused on making it work with the .net core.
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"
]
}
}
}
Tests.fs
module Tests
open Xunit
[<Fact>]
let ``Should Fail`` =
Assert.False true
dotnet
xUnit.net .NET CLI test runner (64-bit .NET Core win10-x64)
Discovering: FSTests
Discovered: FSTests
=== TEST EXECUTION SUMMARY ===
FSTests.dll Total: 0
SUMMARY: Total: 1 targets, Passed: 1, Failed: 0.