@@ -14,6 +14,8 @@ namespace System.Threading.Tests
1414 /// </summary>
1515 public class SemaphoreSlimTests
1616 {
17+ private const uint TimerMaxSupportedTimeout = 0xfffffffe ;
18+
1719 /// <summary>
1820 /// SemaphoreSlim public methods and properties to be tested
1921 /// </summary>
@@ -60,7 +62,7 @@ public static void RunSemaphoreSlimTest1_Wait()
6062 RunSemaphoreSlimTest1_Wait_Helper ( 10 , 10 , 10 , true , null ) ;
6163 RunSemaphoreSlimTest1_Wait_Helper ( 1 , 10 , 10 , true , null ) ;
6264 RunSemaphoreSlimTest1_Wait_Helper ( 0 , 10 , 10 , false , null ) ;
63- RunSemaphoreSlimTest1_Wait_Helper ( 1 , 10 , TimeSpan . FromMilliseconds ( Timer . MaxSupportedTimeout ) , true , null ) ;
65+ RunSemaphoreSlimTest1_Wait_Helper ( 1 , 10 , TimeSpan . FromMilliseconds ( TimerMaxSupportedTimeout ) , true , null ) ;
6466 }
6567
6668 [ Fact ]
@@ -69,7 +71,7 @@ public static void RunSemaphoreSlimTest1_Wait_NegativeCases()
6971 // Invalid timeout
7072 RunSemaphoreSlimTest1_Wait_Helper ( 10 , 10 , - 10 , true , typeof ( ArgumentOutOfRangeException ) ) ;
7173 RunSemaphoreSlimTest1_Wait_Helper
72- ( 10 , 10 , TimeSpan . FromMilliseconds ( Timer . MaxSupportedTimeout + 1 ) , true , typeof ( ArgumentOutOfRangeException ) ) ;
74+ ( 10 , 10 , TimeSpan . FromMilliseconds ( TimerMaxSupportedTimeout + 1 ) , true , typeof ( ArgumentOutOfRangeException ) ) ;
7375 }
7476
7577 [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsThreadingSupported ) ) ]
@@ -88,7 +90,7 @@ public static void RunSemaphoreSlimTest1_WaitAsync()
8890 RunSemaphoreSlimTest1_WaitAsync_Helper ( 10 , 10 , 10 , true , null ) ;
8991 RunSemaphoreSlimTest1_WaitAsync_Helper ( 1 , 10 , 10 , true , null ) ;
9092 RunSemaphoreSlimTest1_WaitAsync_Helper ( 0 , 10 , 10 , false , null ) ;
91- RunSemaphoreSlimTest1_WaitAsync_Helper ( 1 , 10 , TimeSpan . FromMilliseconds ( Timer . MaxSupportedTimeout ) , true , null ) ;
93+ RunSemaphoreSlimTest1_WaitAsync_Helper ( 1 , 10 , TimeSpan . FromMilliseconds ( TimerMaxSupportedTimeout ) , true , null ) ;
9294 }
9395
9496 [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsThreadingSupported ) ) ]
@@ -98,7 +100,7 @@ public static void RunSemaphoreSlimTest1_WaitAsync_NegativeCases()
98100 // Invalid timeout
99101 RunSemaphoreSlimTest1_WaitAsync_Helper ( 10 , 10 , - 10 , true , typeof ( ArgumentOutOfRangeException ) ) ;
100102 RunSemaphoreSlimTest1_WaitAsync_Helper
101- ( 10 , 10 , TimeSpan . FromMilliseconds ( Timer . MaxSupportedTimeout + 1 ) , true , typeof ( ArgumentOutOfRangeException ) ) ;
103+ ( 10 , 10 , TimeSpan . FromMilliseconds ( TimerMaxSupportedTimeout + 1 ) , true , typeof ( ArgumentOutOfRangeException ) ) ;
102104 RunSemaphoreSlimTest1_WaitAsync2 ( ) ;
103105 }
104106
0 commit comments