File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/Nerdbank.Streams.Tests Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -339,10 +339,12 @@ public async Task CreateChannelAsync_IdRecycledFromPriorChannel()
339
339
[ Fact ]
340
340
public async Task CreateChannelAsync_AcceptByAnotherId ( )
341
341
{
342
- var createTask = this . mx1 . OfferChannelAsync ( "1st" , ExpectedTimeoutToken ) ;
343
- var acceptTask = this . mx2 . AcceptChannelAsync ( "2nd" , ExpectedTimeoutToken ) ;
342
+ var cts = new CancellationTokenSource ( ) ;
343
+ var createTask = this . mx1 . OfferChannelAsync ( "1st" , cts . Token ) ;
344
+ var acceptTask = this . mx2 . AcceptChannelAsync ( "2nd" , cts . Token ) ;
344
345
Assert . False ( createTask . IsCompleted ) ;
345
346
Assert . False ( acceptTask . IsCompleted ) ;
347
+ cts . CancelAfter ( ExpectedTimeout ) ;
346
348
await Assert . ThrowsAnyAsync < OperationCanceledException > ( ( ) => createTask ) . WithCancellation ( this . TimeoutToken ) ;
347
349
await Assert . ThrowsAnyAsync < OperationCanceledException > ( ( ) => acceptTask ) . WithCancellation ( this . TimeoutToken ) ;
348
350
}
You can’t perform that action at this time.
0 commit comments