Skip to content

Commit

Permalink
xunit/xunit#3023 and microsoft/testfx#3863: Fix issue with test metho…
Browse files Browse the repository at this point in the history
…ds with generic parameter types
  • Loading branch information
bradwilson committed Oct 2, 2024
1 parent dd3ab46 commit 02233e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<TunnelVisionLabsReferenceAssemblyAnnotatorVersion>1.0.0-alpha.160</TunnelVisionLabsReferenceAssemblyAnnotatorVersion>
<XunitAnalyzersVersion>1.16.0</XunitAnalyzersVersion>
<XunitV2Version>2.9.2-pre.2</XunitV2Version>
<XunitV3Version>0.4.0-pre.21</XunitV3Version>
<XunitV3Version>0.5.0-pre.12</XunitV3Version>
</PropertyGroup>

</Project>
5 changes: 2 additions & 3 deletions src/xunit.runner.visualstudio/Sinks/VsDiscoverySink.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Security.Cryptography;
using System.Text;
Expand Down Expand Up @@ -89,8 +88,8 @@ public void Dispose() =>
// which leads us to the convoluted logic here, which is that we'll add parameter types unless they contain generics, in
// the hopes that that gives us the best possible coverage.
var managedMethodName = testCase.TestMethodName;
if (testCase.TestMethodParameterTypes is not null && testCase.TestMethodParameterTypes.Length > 0 && !testCase.TestMethodParameterTypes.Any(t => t.Contains('`')))
managedMethodName = string.Format(CultureInfo.InvariantCulture, "{0}({1})", managedMethodName, string.Join(",", testCase.TestMethodParameterTypes));
if (testCase.TestMethodParameterTypesVSTest is not null && testCase.TestMethodParameterTypesVSTest.Length > 0)
managedMethodName = string.Format(CultureInfo.InvariantCulture, "{0}({1})", managedMethodName, string.Join(",", testCase.TestMethodParameterTypesVSTest));

result.SetPropertyValue(VsTestRunner.TestCaseUniqueIDProperty, testCase.TestCaseUniqueID);
result.SetPropertyValue(VsTestRunner.TestCaseExplicitProperty, testCase.Explicit);
Expand Down

0 comments on commit 02233e7

Please sign in to comment.