Visual Studio 2015无法显示测试

时间:2015-12-08 16:59:44

标签: visual-studio-2015 asp.net-core xunit dnx

我的测试在使用DNX46的Visual Studio 2015中不可见(测试> Windows>测试资源管理器)

我可以从控制台运行它们(使用dnx测试)。 Bellow the project.json我的测试项目

{
  "version": "1.0.0-*",
  "description": "project Class Library",
  "authors": [ "me" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "dnx46": { }
  },
  "commands": {
    "test": "xunit.runner.dnx"
  },
  "dependencies": {
    "Microsoft.AspNet.TestHost": "1.0.0-rc1-final",
    "NSubstitute": "1.9.2",
    "Search": "1.0.0-*",
    "Search.Infrastructure": "1.0.0-*",
    "Search.Model": "1.0.0-*",
    "Swagger.Net.UI": "1.1.0",
    "xunit": "2.1.0",
    "xunit.runner.dnx": "2.1.0-rc1-build204"
  }
}

我尝试安装SideWaffle,也许我的项目中缺少某些东西,但同样的问题。

1 个答案:

答案 0 :(得分:0)

嗯,解决方法是将命令放在project.json

中的依赖项声明之后
{
  "version": "1.0.0-*",
  "description": "project Class Library",
  "authors": [ "me" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "dnx46": { }
  },
  "dependencies": {
    "Microsoft.AspNet.TestHost": "1.0.0-rc1-final",
    "NSubstitute": "1.9.2",
    "Search": "1.0.0-*",
    "Search.Infrastructure": "1.0.0-*",
    "Search.Model": "1.0.0-*",
    "Swagger.Net.UI": "1.1.0",
    "xunit": "2.1.0",
    "xunit.runner.dnx": "2.1.0-rc1-build204"
  },
  "commands": {
    "test": "xunit.runner.dnx"
  }
}