使Visual Studio 2013 Express for Desktop能够检测到F#测试

dev*_*ium 13 f# nunit unit-testing visual-studio-2013

我已经定义了以下F#文件:

module MyFsTest

open NUnit.Framework
open FsUnit

[<Test>]
let ``1 + 1 = 2``() = Assert.AreEqual(2, 1+1)
Run Code Online (Sandbox Code Playgroud)

然而,当我尝试通过"测试资源管理器"或"右键单击+运行测试"运行它们时,构建已完成,但未检测到/运行测试:

------ Discover test started ------
========== Discover test finished: 0 found (0:00:00,0320018) ==========
Run Code Online (Sandbox Code Playgroud)

谷歌搜索后我发现我的方法似乎类似于@ http://davesquared.net/2013/03/hello-world-testing-in-fsharp.html所采取的步骤,所以我想知道是否还有其他的东西我可能会失踪?

Tom*_*cek 11

要将NUnit测试与内置的Visual Studio测试运行器一起使用,您需要安装NUnit测试适配器.这适用于Visual Studio 2013,但我认为无法将其安装为Express版的扩展.

但是,Express版本包括对Microsoft Visual Studio测试框架的支持,该框架由内置测试运行器支持.用法应该与NUnit非常相似 - 您只需要不同的命名空间.