-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Labels
Milestone
Description
To Reproduce
- Create a new project that targets .NET 10. Specifically, ensure the project file has this setup:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<EnableNUnitRunner>true</EnableNUnitRunner>
<LangVersion>preview</LangVersion>
<TargetFramework>net10.0</TargetFramework>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.10.0" >
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
</ItemGroup>
</Project>- Add a test to the project:
using NUnit.Framework;
namespace NUnitIssue;
public static class TestIssue
{
[TestCase("public class Test { public void Foo(string a = \"c\") { } }", false)]
public static void TestLength(string input, bool expected) =>
Assert.That(input.Length % 2 == 0, Is.EqualTo(expected));
}Expected
The test runs and passes.
Actual
The test doesn't run at all.
Commentary
If I change the test case to this:
[TestCase("public class Test { public void Foo(string a = c) { } }", false)]That passes. Note that in the project, I'm enabling EnableNUnitRunner and TestingPlatformDotnetTestSupport. If those are false, the test case runs as expected. Something with the escaped double-quote seems to be confusing NUnit such that it won't run the test if the testing platform bits are enabled.
Note: you may not need to be targeting .NET 10 and a preview version of the language for this to show up as the issue seems to be related to testing platform enablement and not a version of .NET and/or the language per-se.