通过 ReSharper 运行的 NUnit .NET Core [英] NUnit .NET Core running through ReSharper
问题描述
我正在尝试通过 ReSharper 在 Visual Studio 2017 中为 .NET Core 2.0 项目运行 NUnit 测试.我已经将测试 .proj 程序集设置为控制台应用程序和类库.所以它似乎不是输出类型.该解决方案没有发现任何单元测试,只是在运行 0 个测试时不显示任何结果.
这是我的测试项目的 .csproj 文件:
<属性组><TargetFramework>netcoreapp2.0</TargetFramework><AssemblyName>eCorp.WebStore.OrderService.Tests</AssemblyName><RootNamespace>eCorp.WebStore.OrderService.Tests</RootNamespace><应用程序图标/><OutputType>Exe</OutputType><启动对象/></PropertyGroup><项目组><PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0"/><PackageReference Include="NUnit" Version="3.9.0"/><PackageReference Include="NUnit3TestAdapter" Version="3.9.0"/></项目组><项目组><ProjectReference Include="....CoreOrderService.DomainOrderService.Domain.csproj"/><ProjectReference Include="....CoreOrderService.InfrastructureOrderService.Infrastructure.csproj"/></项目组></项目>
我已经找到了:在 .NET Core 中运行 NUnit 测试>
提供的解决方案似乎都不适合我.
我通过安装以下 NuGet 包解决了
- NUnit
- NUnit3TestAdapter
- Microsoft.NET.Test.SDK
I am trying to run NUnit tests for a .NET Core 2.0 project in Visual Studio 2017 through ReSharper. I've had the test .proj assembly set both as console application and class library. So it doesn't seem to be the output type. The solution does not discover any unit test and just displays no results with 0 tests run.
Here is my .csproj file for the tests project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>eCorp.WebStore.OrderService.Tests</AssemblyName>
<RootNamespace>eCorp.WebStore.OrderService.Tests</RootNamespace>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="NUnit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="....CoreOrderService.DomainOrderService.Domain.csproj" />
<ProjectReference Include="....CoreOrderService.InfrastructureOrderService.Infrastructure.csproj" />
</ItemGroup>
</Project>
I found this already: Run NUnit tests in .NET Core
None of the provided solutions seem to work for me.
I solved by installing the following NuGet packages
- NUnit
- NUnit3TestAdapter
- Microsoft.NET.Test.Sdk
这篇关于通过 ReSharper 运行的 NUnit .NET Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!