Skip to content

Commit 02233e7

Browse files
committed
xunit/xunit#3023 and microsoft/testfx#3863: Fix issue with test methods with generic parameter types
1 parent dd3ab46 commit 02233e7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<TunnelVisionLabsReferenceAssemblyAnnotatorVersion>1.0.0-alpha.160</TunnelVisionLabsReferenceAssemblyAnnotatorVersion>
1313
<XunitAnalyzersVersion>1.16.0</XunitAnalyzersVersion>
1414
<XunitV2Version>2.9.2-pre.2</XunitV2Version>
15-
<XunitV3Version>0.4.0-pre.21</XunitV3Version>
15+
<XunitV3Version>0.5.0-pre.12</XunitV3Version>
1616
</PropertyGroup>
1717

1818
</Project>

src/xunit.runner.visualstudio/Sinks/VsDiscoverySink.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
4-
using System.Linq;
54
using System.Linq.Expressions;
65
using System.Security.Cryptography;
76
using System.Text;
@@ -89,8 +88,8 @@ public void Dispose() =>
8988
// which leads us to the convoluted logic here, which is that we'll add parameter types unless they contain generics, in
9089
// the hopes that that gives us the best possible coverage.
9190
var managedMethodName = testCase.TestMethodName;
92-
if (testCase.TestMethodParameterTypes is not null && testCase.TestMethodParameterTypes.Length > 0 && !testCase.TestMethodParameterTypes.Any(t => t.Contains('`')))
93-
managedMethodName = string.Format(CultureInfo.InvariantCulture, "{0}({1})", managedMethodName, string.Join(",", testCase.TestMethodParameterTypes));
91+
if (testCase.TestMethodParameterTypesVSTest is not null && testCase.TestMethodParameterTypesVSTest.Length > 0)
92+
managedMethodName = string.Format(CultureInfo.InvariantCulture, "{0}({1})", managedMethodName, string.Join(",", testCase.TestMethodParameterTypesVSTest));
9493

9594
result.SetPropertyValue(VsTestRunner.TestCaseUniqueIDProperty, testCase.TestCaseUniqueID);
9695
result.SetPropertyValue(VsTestRunner.TestCaseExplicitProperty, testCase.Explicit);

0 commit comments

Comments
 (0)