我正在使用带有xUnit 2的Visual Studio 2015和Visual Studio测试运行器。 I have this sample project that exhibits the following problem:
如果我从方法返回string
,Task<string>
或MyObject
,则测试通常会显示在测试资源管理器中。
但是,如果我返回Task<MyObject>
,则测试会显示在“外部”类别下,并且在我单击编辑器中的“运行测试”时不会运行。
可能导致这种情况的原因是什么?我发现了两个听起来相似的Stack Overflow问题,但它们似乎并不适用:
以下是Visual Studio“关于”页面中的信息。
Microsoft Visual Studio Professional 2015版本14.0.25431.01更新 3 Microsoft .NET Framework版本4.6.01586
已安装版本:专业
LightSwitch for Visual Studio 2015 00322-40000-00000-AA445 Microsoft 适用于Visual Studio 2015的LightSwitch
Microsoft Visual Studio Tools for Applications 2015
00322-40000-00000-AA445用于应用程序的Microsoft Visual Studio工具 2015Visual Basic 2015 00322-40000-00000-AA445 Microsoft Visual Basic 2015
Visual C#2015 00322-40000-00000-AA445 Microsoft Visual C#2015
Visual C ++ 2015 00322-40000-00000-AA445 Microsoft Visual C ++ 2015
Visual F#2015 00322-40000-00000-AA445 Microsoft Visual F#2015
Visual Studio包7.17.00119.9的应用程序洞察工具 Visual Studio的应用程序洞察工具
ASP.NET和Web Tools 2015.1 14.1.20907.0 ASP.NET和Web工具 2015.1
ASP.NET Web框架和工具2012.2 4.1.41102.0另外 信息,请访问http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web框架和工具2013 5.2.40314.0有关其他信息 信息,请访问http://www.asp.net/
Azure App Service Tools v2.8.1 14.0.11123.0 Azure App服务工具 v2.8.1
Breakpoint Generator 1.0自动为所有人生成跟踪点 解决方案中的公共入口点。
通用Azure工具1.8提供Azure使用的公共服务 移动服务和Microsoft Azure工具。
JavaScript语言服务2.0 JavaScript语言服务
JavaScript Project System 2.0 JavaScript项目系统
JetBrains ReSharper Ultimate 2016.1.2 Build 105.0.20160522.80219 适用于Microsoft Visual Studio的JetBrains ReSharper Ultimate软件包。对于 有关ReSharper Ultimate的更多信息,请访问 http://www.jetbrains.com/resharper。版权所有©2017 JetBrains,Inc。
Markdown Editor 1.10.186带有直播功能的全功能Markdown编辑器 预览和语法高亮。支持GitHub风格的Markdown。
Microsoft .NET核心工具(预览2)14.1.20907.0 Microsoft .NET 核心工具(预览2)
Microsoft Azure移动服务工具1.4 Microsoft Azure Mobile 服务工具
NuGet Package Manager 3.5.0 Visual Studio中的NuGet包管理器。 有关NuGet的更多信息,请访问http://docs.nuget.org/。
PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio 扩展以可视化PreEmptive中的汇总摘要 分析产品。
SQL Server Analysis Services 13.0.1700.68 Microsoft SQL Server Analysis Services Designer版本13.0.1700.68
SQL Server数据工具14.0.60812.0 Microsoft SQL Server数据工具
SQL Server Integration Services Microsoft SQL Server集成 Services Designer版本13.0.1601.5
SQL Server Reporting Services 13.0.1700.68 Microsoft SQL Server Reporting Services Designers版本13.0.1700.68
TargetFrameworkMigrator 1.0批量更改.Net项目目标 框架
TypeScript 1.8.36.0 Visual Studio的TypeScript工具
适用于通用Windows应用程序的Visual Studio工具14.0.25420.01 适用于通用Windows应用程序的Visual Studio工具允许您构建一个 单一的通用应用体验,可以覆盖每个运行的设备 Windows 10:手机,平板电脑,PC等。它包括微软 Windows 10软件开发工具包。
VsVim 2.2.0.0 VsVim是Visual Studio的Vim模拟器
Web Essentials 2015.3 3.0.235为Visual添加了许多有用的功能 面向Web开发人员的Studio。需要Visual Studio 2015
Windows Installer XML工具集3.10.3.3007 Windows Installer XML 工具集版本3.10.3.3007版权所有(c).NET Foundation和 贡献者。保留所有权利。
答案 0 :(得分:0)
我还有几个神秘的标记为&#34;外部&#34;使用async Task<MyObject>
电话时。我的解决方法是在测试程序集中定义MyObject
。显然,这不适用于所有情况,但它对我有用,因为我只是将JSON数据反序列化为这些有问题的异步函数调用中的POCO对象。