Skip to content

Commit 7badf84

Browse files
committed
Source cleanup recommendations
1 parent eba34fb commit 7badf84

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/xunit.runner.visualstudio/Utility/TestCaseFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ List<string> GetSupportedPropertyNames()
155155
return supportedPropertyNames;
156156
}
157157

158-
static IEnumerable<KeyValuePair<string, string>> GetTraits(TestCase testCase)
158+
static KeyValuePair<string, string>[] GetTraits(TestCase testCase)
159159
{
160160
var traitProperty = TestProperty.Find("TestObject.Traits");
161161
if (traitProperty is not null)

src/xunit.runner.visualstudio/VsTestRunner.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,14 @@ public void DiscoverTests(
172172
// We can't use await here because the contract from VSTest says we have to wait for everything to finish
173173
// before returning from this function.
174174
DiscoverTests(
175-
sources, loggerHelper, testPlatformContext, runSettings,
175+
sources, loggerHelper, runSettings,
176176
(source, discoverer, discoveryOptions) => new VsDiscoverySink(source, loggerHelper, discoverySink, discoveryOptions, testPlatformContext, testCaseFilter, () => cancelled)
177177
).GetAwaiter().GetResult();
178178
}
179179

180180
async Task DiscoverTests<TVisitor>(
181181
IEnumerable<string> sources,
182182
LoggerHelper logger,
183-
TestPlatformContext testPlatformContext,
184183
RunSettings runSettings,
185184
Func<string, IFrontControllerDiscoverer, ITestFrameworkDiscoveryOptions, TVisitor> visitorFactory,
186185
Action<string, IFrontControllerDiscoverer, ITestFrameworkDiscoveryOptions, TVisitor>? visitComplete = null)
@@ -343,7 +342,7 @@ internal static IRunnerReporter GetRunnerReporter(
343342
return reporter ?? new DefaultRunnerReporter();
344343
}
345344

346-
static IList<DiscoveredTestCase> GetVsTestCases(
345+
static List<DiscoveredTestCase> GetVsTestCases(
347346
string source,
348347
VsExecutionDiscoverySink visitor,
349348
LoggerHelper logger,
@@ -393,12 +392,11 @@ public void RunTests(
393392
RunTests(
394393
runContext, frameworkHandle, logger, testPlatformContext, runSettings,
395394
() =>
396-
tests
395+
[.. tests
397396
.Distinct(TestCaseUniqueIDComparer.Instance)
398397
.GroupBy(testCase => testCase.Source)
399398
.Select(group => AssemblyRunInfo.Create(logger, project, runSettings, group.Key, [.. group], runExplicitTests))
400-
.WhereNotNull()
401-
.ToList()
399+
.WhereNotNull()]
402400
).GetAwaiter().GetResult();
403401
}
404402

@@ -428,7 +426,7 @@ public void RunTests(
428426
// before returning from this function.
429427
RunTests(
430428
runContext, frameworkHandle, logger, testPlatformContext, runSettings,
431-
() => sources.Select(source => AssemblyRunInfo.Create(logger, project, runSettings, Path.GetFullPath(source))).WhereNotNull().ToList()
429+
() => [.. sources.Select(source => AssemblyRunInfo.Create(logger, project, runSettings, Path.GetFullPath(source))).WhereNotNull()]
432430
).GetAwaiter().GetResult();
433431
}
434432

0 commit comments

Comments
 (0)