@@ -18,16 +18,15 @@ public class ThrottlingCacheTests
1818 private readonly MsalServiceException _ex2 = new MsalServiceException ( "code2" , "msg2" ) ;
1919
2020 [ TestMethod ]
21- public async Task GetRemovesExpired_Async ( )
21+ public void GetRemovesExpired ( )
2222 {
2323 // Arrange
2424 ThrottlingCache cache = new ThrottlingCache ( ) ;
2525
26- cache . AddAndCleanup ( "k1" , new ThrottlingCacheEntry ( _ex1 , TimeSpan . FromMilliseconds ( 1 ) ) , _logger ) ; // expired
26+ cache . AddAndCleanup ( "k1" , new ThrottlingCacheEntry ( _ex1 , TimeSpan . FromMilliseconds ( - 10000 ) ) , _logger ) ; // expired
2727 cache . AddAndCleanup ( "k2" , new ThrottlingCacheEntry ( _ex2 , TimeSpan . FromMilliseconds ( 10000 ) ) , _logger ) ;
2828
2929 // Act
30- await Task . Delay ( 1 ) . ConfigureAwait ( false ) ;
3130 bool isFound1 = cache . TryGetOrRemoveExpired ( "k1" , _logger , out MsalServiceException foundEx1 ) ;
3231 bool isFound2 = cache . TryGetOrRemoveExpired ( "k2" , _logger , out MsalServiceException foundEx2 ) ;
3332
@@ -39,16 +38,15 @@ public async Task GetRemovesExpired_Async()
3938 }
4039
4140 [ TestMethod ]
42- public async Task TestCleanup_Async ( )
41+ public void TestCleanup ( )
4342 {
4443 // Arrange
4544 ThrottlingCache cache = new ThrottlingCache ( 50 ) ;
4645
47- cache . AddAndCleanup ( "k1" , new ThrottlingCacheEntry ( _ex1 , TimeSpan . FromMilliseconds ( 1 ) ) , _logger ) ; // expired
46+ cache . AddAndCleanup ( "k1" , new ThrottlingCacheEntry ( _ex1 , TimeSpan . FromMilliseconds ( - 10000 ) ) , _logger ) ; // expired
4847 cache . AddAndCleanup ( "k2" , new ThrottlingCacheEntry ( _ex2 , TimeSpan . FromMilliseconds ( 10000 ) ) , _logger ) ;
4948
5049 // Act - should trigger a cleanup
51- await Task . Delay ( 50 ) . ConfigureAwait ( false ) ;
5250 cache . AddAndCleanup ( "k3" , new ThrottlingCacheEntry ( _ex2 , TimeSpan . FromMilliseconds ( 1000 ) ) , _logger ) ;
5351
5452 // Assert
0 commit comments