File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed 
projects/Test/Integration Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,29 @@ public async Task TestShutdownSignalPropagationToChannels()
162162            await  WaitAsync ( tcs ,  TimeSpan . FromSeconds ( 3 ) ,  "channel shutdown" ) ; 
163163        } 
164164
165+         [ Fact ] 
166+         public  async  Task  TestShutdownCancellation ( ) 
167+         { 
168+             using  var  cts  =  new  CancellationTokenSource ( TimeSpan . FromSeconds ( 1 ) ) ; 
169+             var  tcs  =  new  TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ; 
170+ 
171+             _conn . ConnectionShutdownAsync  +=  async  ( channel ,  args )  => 
172+             { 
173+                 try 
174+                 { 
175+                     await  Task . Delay ( TimeSpan . FromMinutes ( 1 ) ,  args . CancellationToken ) ; 
176+                 } 
177+                 catch  ( OperationCanceledException ) 
178+                 { 
179+                     tcs . SetResult ( true ) ; 
180+                 } 
181+             } ; 
182+ 
183+             await  _conn . CloseAsync ( cancellationToken :  cts . Token ) ; 
184+ 
185+             await  WaitAsync ( tcs ,  TimeSpan . FromSeconds ( 3 ) ,  "connection shutdown" ) ; 
186+         } 
187+ 
165188        [ Fact ] 
166189        public  async  Task  TestShutdownSignalPropagationWithCancellationToChannels ( ) 
167190        { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments