Visual Studio Team♦♦·2017年3月10日下午01:06感谢您的反馈! Visual Studio团队已确定此问题不是错误 . 但是,我们会考虑这些反馈,并创建了https://github.com/Microsoft/vstest/issues/592来跟踪这一情况 . 请随时投票支持该问题 .
上面提到的关于Microsoft VS Test repo Create Unit Test Context Menu Missing (.net core projects)的github问题有点令人困惑 . 它's asking for this feature to be added for .NET Core projects too but then a Microsoft employees talk about having a fix for an issue. I believe that employee is referring to the old bug where the context menu option wasn' t适用于完整的.NET框架项目as discussed in this question,这也在该线程中提到 . 据我所知,线程并没有说他们已经为.NET Core项目添加了菜单选项 .
我刚刚查看了一份Visual Studio Professional 2017,版本15.2(26430.6)和我 do 的针对完整.NET框架的项目的创建单元测试选项(这个目标是.NET Framework 4.5.1) :
1 回答
对于面向.NET Core和.NET Standard的项目,尚不支持“创建单元测试”上下文菜单选项 .
文档是updated to reflect this in July 2018,现在声明:
此功能目前是Visual Studio的slated for release in Version 15.9 .
请参阅以下更新以获取更多历史记录和详细信
Earlier answer
来自Microsoft's Jayarani Garg的这个GitHub条目证实它仅适用于面向完整.NET框架的项目:
这是设计而不是根据this Visual Studio Team comment在同一Visual Studio开发人员社区页面上的错误:
上面提到的关于Microsoft VS Test repo Create Unit Test Context Menu Missing (.net core projects)的github问题有点令人困惑 . 它's asking for this feature to be added for .NET Core projects too but then a Microsoft employees talk about having a fix for an issue. I believe that employee is referring to the old bug where the context menu option wasn' t适用于完整的.NET框架项目as discussed in this question,这也在该线程中提到 . 据我所知,线程并没有说他们已经为.NET Core项目添加了菜单选项 .
我刚刚查看了一份Visual Studio Professional 2017,版本15.2(26430.6)和我 do 的针对完整.NET框架的项目的创建单元测试选项(这个目标是.NET Framework 4.5.1) :
但我 don't 有一个针对.NETCoreApp 1.1的项目:
Update June 2018:
微软已经注意到feature request的upvotes,并计划在15.8版中引入.NET Core项目的上下文菜单选项:
Update July 2018 Create unit test method stubs with the Create Unit Tests command页面的been updated now反映出这对.NET Core不起作用 .
Update August 2018:
正如下面的@gartenriese指出的那样,微软描述为跟踪这项工作的GitHub问题3425被移到了15.9 milestone on 02 August 2018 .