【发布时间】:2015-05-29 11:30:00
【问题描述】:
尝试将 xunit 测试添加到我的 ASP.NET 5 项目中,我添加了一个类库并像这样填充 project.json:
{
"version": "1.0.0-*",
"description": "",
"authors": [ "" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"xunit": "2.1.0-beta2-build2981",
"xunit.runner.visualstudio": "2.1.0-beta2-build1055"
},
"commands": {
"test": "xunit.runner.visualstudio"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-22816",
"System.Linq": "4.0.0-beta-22816",
"System.Threading": "4.0.10-beta-22816",
"Microsoft.CSharp": "4.0.0-beta-22816"
}
}
}
}
但 Visual Studio 无法识别我在测试资源管理器中的任何单元测试:
public class Class1
{
[Fact]
public void PassingTest()
{
Assert.Equal(4, Add(2, 2));
}
[Fact]
public void FailingTest()
{
Assert.Equal(5, Add(2, 2));
}
int Add(int x, int y)
{
return x + y;
}
}
我错过了什么?
【问题讨论】:
-
您使用的是什么 VS 版本以及什么运行时 (DNX/KRE)?
标签: asp.net-core visual-studio-2015 xunit.net