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 @@ -300,10 +300,12 @@ public async Task CreateChannelAsync_IdRecycledFromPriorChannel()
300
300
[ Fact ]
301
301
public async Task CreateChannelAsync_AcceptByAnotherId ( )
302
302
{
303
- var createTask = this . mx1 . OfferChannelAsync ( "1st" , ExpectedTimeoutToken ) ;
304
- var acceptTask = this . mx2 . AcceptChannelAsync ( "2nd" , ExpectedTimeoutToken ) ;
303
+ var cts = new CancellationTokenSource ( ) ;
304
+ var createTask = this . mx1 . OfferChannelAsync ( "1st" , cts . Token ) ;
305
+ var acceptTask = this . mx2 . AcceptChannelAsync ( "2nd" , cts . Token ) ;
305
306
Assert . False ( createTask . IsCompleted ) ;
306
307
Assert . False ( acceptTask . IsCompleted ) ;
308
+ cts . CancelAfter ( ExpectedTimeout ) ;
307
309
await Assert . ThrowsAnyAsync < OperationCanceledException > ( ( ) => createTask ) . WithCancellation ( this . TimeoutToken ) ;
308
310
await Assert . ThrowsAnyAsync < OperationCanceledException > ( ( ) => acceptTask ) . WithCancellation ( this . TimeoutToken ) ;
309
311
}
You can’t perform that action at this time.
0 commit comments