@@ -271,21 +271,20 @@ void RunTests(IRunContext runContext, IFrameworkHandle frameworkHandle, Stopwatc
271271 using ( AssemblyHelper . SubscribeResolve ( ) )
272272 if ( parallelizeAssemblies )
273273 assemblies
274- . Select ( runInfo => RunTestsInAssemblyAsync ( runContext , frameworkHandle , toDispose , runInfo , stopwatch ) )
274+ . Select ( runInfo => RunTestsInAssemblyAsync ( frameworkHandle , toDispose , runInfo , stopwatch ) )
275275 . ToList ( )
276276 . ForEach ( @event => @event . WaitOne ( ) ) ;
277277 else
278278 assemblies
279- . ForEach ( runInfo => RunTestsInAssembly ( runContext , frameworkHandle , toDispose , runInfo , stopwatch ) ) ;
279+ . ForEach ( runInfo => RunTestsInAssembly ( frameworkHandle , toDispose , runInfo , stopwatch ) ) ;
280280 }
281281 finally
282282 {
283283 toDispose . ForEach ( disposable => disposable . Dispose ( ) ) ;
284284 }
285285 }
286286
287- void RunTestsInAssembly ( IDiscoveryContext discoveryContext ,
288- IFrameworkHandle frameworkHandle ,
287+ void RunTestsInAssembly ( IFrameworkHandle frameworkHandle ,
289288 List < IDisposable > toDispose ,
290289 AssemblyRunInfo runInfo ,
291290 Stopwatch stopwatch )
@@ -319,12 +318,19 @@ void RunTestsInAssembly(IDiscoveryContext discoveryContext,
319318 lock ( toDispose )
320319 toDispose . Add ( controller ) ;
321320
322- var xunitTestCases = runInfo . TestCases . ToDictionary ( tc => controller . Deserialize ( tc . GetPropertyValue < string > ( SerializedTestCaseProperty , null ) ) ) ;
321+ var testCaseMappings = runInfo . TestCases
322+ . Select ( tc => new
323+ {
324+ VsTestCase = tc ,
325+ XunitTestCase = controller . Deserialize ( tc . GetPropertyValue < string > ( SerializedTestCaseProperty , null ) )
326+ } )
327+ . ToList ( ) ;
328+ var testCaseLookup = testCaseMappings . ToDictionary ( tc => tc . XunitTestCase . UniqueID , tc => tc . VsTestCase ) ;
323329 var executionOptions = TestFrameworkOptions . ForExecution ( runInfo . Configuration ) ;
324330
325- using ( var executionVisitor = new VsExecutionVisitor ( frameworkHandle , xunitTestCases , executionOptions , ( ) => cancelled ) )
331+ using ( var executionVisitor = new VsExecutionVisitor ( frameworkHandle , testCaseLookup , executionOptions , ( ) => cancelled ) )
326332 {
327- controller . RunTests ( xunitTestCases . Keys . ToList ( ) , executionVisitor , executionOptions ) ;
333+ controller . RunTests ( testCaseMappings . Select ( tc => tc . XunitTestCase ) . ToList ( ) , executionVisitor , executionOptions ) ;
328334 executionVisitor . Finished . WaitOne ( ) ;
329335 }
330336
@@ -333,8 +339,7 @@ void RunTestsInAssembly(IDiscoveryContext discoveryContext,
333339 frameworkHandle . SendMessage ( TestMessageLevel . Informational , String . Format ( "[xUnit.net {0}] Execution finished: {1}" , stopwatch . Elapsed , assemblyDisplayName ) ) ;
334340 }
335341
336- ManualResetEvent RunTestsInAssemblyAsync ( IDiscoveryContext discoveryContext ,
337- IFrameworkHandle frameworkHandle ,
342+ ManualResetEvent RunTestsInAssemblyAsync ( IFrameworkHandle frameworkHandle ,
338343 List < IDisposable > toDispose ,
339344 AssemblyRunInfo runInfo ,
340345 Stopwatch stopwatch )
@@ -344,7 +349,7 @@ ManualResetEvent RunTestsInAssemblyAsync(IDiscoveryContext discoveryContext,
344349 {
345350 try
346351 {
347- RunTestsInAssembly ( discoveryContext , frameworkHandle , toDispose , runInfo , stopwatch ) ;
352+ RunTestsInAssembly ( frameworkHandle , toDispose , runInfo , stopwatch ) ;
348353 }
349354 finally
350355 {
0 commit comments