File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1- using Microsoft . Testing . Platform . Extensions . Messages ;
1+ using System . Collections . Concurrent ;
22using TUnit . Core ;
3- using TUnit . Core . Data ;
43using TUnit . Engine . Interfaces ;
54using TUnit . Engine . Logging ;
65using TUnit . Engine . Services . TestExecution ;
@@ -36,13 +35,17 @@ internal TestRunner(
3635 _testStateManager = testStateManager ;
3736 }
3837
39- private readonly ThreadSafeDictionary < string , TaskCompletionSource < bool > > _executingTests = new ( ) ;
38+ private readonly ConcurrentDictionary < string , TaskCompletionSource < bool > > _executingTests = new ( ) ;
4039 private Exception ? _firstFailFastException ;
4140
4241 public ValueTask ExecuteTestAsync ( AbstractExecutableTest test , CancellationToken cancellationToken )
4342 {
43+ if ( _executingTests . TryGetValue ( test . TestId , out var existingTcs ) )
44+ {
45+ return new ValueTask ( existingTcs . Task ) ;
46+ }
4447 var tcs = new TaskCompletionSource < bool > ( ) ;
45- var existingTcs = _executingTests . GetOrAdd ( test . TestId , _ => tcs ) ;
48+ existingTcs = _executingTests . GetOrAdd ( test . TestId , tcs ) ;
4649
4750 if ( existingTcs != tcs )
4851 {
You can’t perform that action at this time.
0 commit comments