File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
test/Soenneker.Utils.BackgroundQueue.Tests Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 1- using System . Threading . Tasks ;
1+ using System . Threading ;
2+ using System . Threading . Tasks ;
23using Soenneker . Tests . Unit ;
34using Xunit ;
45
@@ -25,5 +26,5 @@ public interface IFixturedUnitTest : IAsyncLifetime
2526 /// <summary>
2627 /// Checks the background queue to see if it's empty, and loops until it is
2728 /// </summary>
28- ValueTask WaitOnQueueToEmpty ( ) ;
29+ ValueTask WaitOnQueueToEmpty ( CancellationToken cancellationToken = default ) ;
2930}
Original file line number Diff line number Diff line change @@ -28,20 +28,20 @@ private async ValueTask TestValueTask()
2828 [ Fact ]
2929 public async Task WaitOnQueueToEmpty_should_complete_with_Task ( )
3030 {
31- await _util . QueueTask ( _ => TestTask ( ) ) ;
31+ await _util . QueueTask ( _ => TestTask ( ) , CancellationToken ) ;
3232
33- await WaitOnQueueToEmpty ( ) ;
33+ await WaitOnQueueToEmpty ( CancellationToken ) ;
3434
35- await Task . Delay ( 500 ) ;
35+ await Task . Delay ( 500 , CancellationToken ) ;
3636 }
3737
3838 [ Fact ]
3939 public async Task WaitOnQueueToEmpty_should_complete_with_ValueTask ( )
4040 {
41- await _util . QueueValueTask ( _ => TestValueTask ( ) ) ;
41+ await _util . QueueValueTask ( _ => TestValueTask ( ) , CancellationToken ) ;
4242
43- await WaitOnQueueToEmpty ( ) ;
43+ await WaitOnQueueToEmpty ( CancellationToken ) ;
4444
45- await Task . Delay ( 500 ) ;
45+ await Task . Delay ( 500 , CancellationToken ) ;
4646 }
4747}
Original file line number Diff line number Diff line change @@ -71,15 +71,15 @@ public void CreateScope()
7171 Scope = Fixture . ServiceProvider . CreateAsyncScope ( ) ;
7272 }
7373
74- public async ValueTask WaitOnQueueToEmpty ( )
74+ public async ValueTask WaitOnQueueToEmpty ( CancellationToken cancellationToken = default )
7575 {
7676 const int delayMs = 500 ;
7777
7878 bool isProcessing ;
7979
8080 do
8181 {
82- isProcessing = await _queueInformationUtil . Value . IsProcessing ( ) . NoSync ( ) ;
82+ isProcessing = await _queueInformationUtil . Value . IsProcessing ( cancellationToken ) . NoSync ( ) ;
8383
8484 if ( isProcessing )
8585 {
You can’t perform that action at this time.
0 commit comments