-
-
Save ghelyar/2c85b4d264a586602fdd357c8723b193 to your computer and use it in GitHub Desktop.
nunit3testadapter 4.4.0 repro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ dotnet --info | |
.NET SDK (reflecting any global.json): | |
Version: 6.0.406 | |
Commit: 2988897946 | |
Runtime Environment: | |
OS Name: debian | |
OS Version: 11 | |
OS Platform: Linux | |
RID: debian.11-x64 | |
Base Path: /usr/share/dotnet/sdk/6.0.406/ | |
global.json file: | |
Not found | |
Host: | |
Version: 6.0.14 | |
Architecture: x64 | |
Commit: 2a90daa2cc | |
.NET SDKs installed: | |
6.0.406 [/usr/share/dotnet/sdk] | |
.NET runtimes installed: | |
Microsoft.AspNetCore.App 6.0.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] | |
Microsoft.NETCore.App 6.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App] | |
Download .NET: | |
https://aka.ms/dotnet-download | |
Learn about .NET Runtimes and SDKs: | |
https://aka.ms/dotnet/runtimes-sdk-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Diagnostics.HealthChecks; | |
using Microsoft.AspNetCore.Routing; | |
namespace lib; | |
public static class Class1 | |
{ | |
public static void MapHealthChecks(IEndpointRouteBuilder builder) | |
{ | |
builder.MapHealthChecks("/foo", new HealthCheckOptions { Predicate = check => check.Tags.Contains("foo") }); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework>net6.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | |
</ItemGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" /> | |
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.14" /> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using lib; | |
using Microsoft.AspNetCore.Routing; | |
using Moq; | |
using NUnit.Framework; | |
namespace tests; | |
[TestFixture] | |
public class Class1Tests | |
{ | |
[Test] | |
public void Test() | |
{ | |
// the exception just saves writing a lot of unrelated set up | |
var exception = new Exception("expected exception"); | |
var builder = new Mock<IEndpointRouteBuilder>(); | |
builder.Setup(b => b.ServiceProvider).Throws(exception); | |
Assert.That(() => Class1.MapHealthChecks(builder.Object), Throws.Exception.SameAs(exception)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework>net6.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /> | |
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | |
<PackageReference Include="Moq" Version="4.18.4" /> | |
<PackageReference Include="NUnit" Version="3.13.3" /> | |
<PackageReference Include="NUnit3TestAdapter" Version="4.4.0" /> | |
</ItemGroup> | |
<ItemGroup> | |
<ProjectReference Include="..\lib\lib.csproj" /> | |
</ItemGroup> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment