我正在尝试将单元测试项目添加到ASP.NET 5解决方案中。
我添加了ASP.NET 5类库项目,并在我的project.json中引用了所需的包,如下所示: -
{ "dependencies": { "xunit.runners": "1.0.0-alpha3", "Moq": "4.2.1502.911", "xunit": "2.0.0-rc4-build2924" }, "commands": { "test": "Xunit.KRunner" }, "frameworks": { "net451": { "dependencies": { } } } }当我尝试在类文件中引用一个Xunit的attrivute时,如下所示: -
使用Xunit;
namespace LondonUnderground.UnitTests { public class RoutesTests { [Fact] public void TestShizz() { } } }我收到一个错误,告诉我我需要System.Runtime版本4.0.0.0才能访问“Attribute”类。
如果我尝试在project.json文件中添加对此的引用,它将安装System.Runtime 4.0.20.0 Beta。
有什么建议么?
I'm trying to add Unit Test Project to a ASP.NET 5 Solution.
I've added ASP.NET 5 class library project and referenced the required packaes in my project.json as below :-
{ "dependencies": { "xunit.runners": "1.0.0-alpha3", "Moq": "4.2.1502.911", "xunit": "2.0.0-rc4-build2924" }, "commands": { "test": "Xunit.KRunner" }, "frameworks": { "net451": { "dependencies": { } } } }When I try to reference a to an attrivute of Xunit in a class file as follows :-
using Xunit;
namespace LondonUnderground.UnitTests { public class RoutesTests { [Fact] public void TestShizz() { } } }I'm getting an error, telling me that i need the System.Runtime version 4.0.0.0 in order to access "Attribute" class.
If i try adding a reference to this in the project.json file, it installs System.Runtime 4.0.20.0 Beta.
Any suggestions?
最满意答案
这是我的project.json,它可以用于测试。
{ "version": "1.0.0-*", "dependencies": { "xunit": "2.1.0-beta1-*", "xunit.runner.aspnet": "2.1.0-beta1-*" }, "frameworks": { "aspnet50": { "dependencies": { } }, "aspnetcore50": { "dependencies": { "System.Runtime": "4.0.20-beta-22523" } } }, "commands": { "test": "xunit.runner.aspnet" } }this is my project.json that works with tests.
{ "version": "1.0.0-*", "dependencies": { "xunit": "2.1.0-beta1-*", "xunit.runner.aspnet": "2.1.0-beta1-*" }, "frameworks": { "aspnet50": { "dependencies": { } }, "aspnetcore50": { "dependencies": { "System.Runtime": "4.0.20-beta-22523" } } }, "commands": { "test": "xunit.runner.aspnet" } }更多推荐
发布评论