Skip to content

Commit 53ec2ab

Browse files
committed
Fix TimeSpan in tests
1 parent 5fa5009 commit 53ec2ab

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
262262
}
263263

264264
// Call wait with the timeout milliseconds
265-
return Wait(totalMilliseconds == timeout.Infinite ? Timeout.UnsignedInfinite : (uint)totalMilliseconds, cancellationToken);
265+
return Wait(totalMilliseconds == Timeout.Infinite ? Timeout.UnsignedInfinite : (uint)totalMilliseconds, cancellationToken);
266266
}
267267

268268
/// <summary>

src/libraries/System.Threading/tests/SemaphoreSlimTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void RunSemaphoreSlimTest1_Wait()
6060
RunSemaphoreSlimTest1_Wait_Helper(10, 10, 10, true, null);
6161
RunSemaphoreSlimTest1_Wait_Helper(1, 10, 10, true, null);
6262
RunSemaphoreSlimTest1_Wait_Helper(0, 10, 10, false, null);
63-
RunSemaphoreSlimTest1_Wait_Helper(1, 10, new TimeSpan(0, 0, Timer.MaxSupportedTimeout), true, null);
63+
RunSemaphoreSlimTest1_Wait_Helper(1, 10, TimeSpan.FromMilliseconds(Timer.MaxSupportedTimeout), true, null);
6464
}
6565

6666
[Fact]
@@ -69,7 +69,7 @@ public static void RunSemaphoreSlimTest1_Wait_NegativeCases()
6969
// Invalid timeout
7070
RunSemaphoreSlimTest1_Wait_Helper(10, 10, -10, true, typeof(ArgumentOutOfRangeException));
7171
RunSemaphoreSlimTest1_Wait_Helper
72-
(10, 10, new TimeSpan(0, 0, Timer.MaxSupportedTimeout + 1), true, typeof(ArgumentOutOfRangeException));
72+
(10, 10, TimeSpan.FromMilliseconds(Timer.MaxSupportedTimeout + 1), true, typeof(ArgumentOutOfRangeException));
7373
}
7474

7575
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
@@ -88,7 +88,7 @@ public static void RunSemaphoreSlimTest1_WaitAsync()
8888
RunSemaphoreSlimTest1_WaitAsync_Helper(10, 10, 10, true, null);
8989
RunSemaphoreSlimTest1_WaitAsync_Helper(1, 10, 10, true, null);
9090
RunSemaphoreSlimTest1_WaitAsync_Helper(0, 10, 10, false, null);
91-
RunSemaphoreSlimTest1_WaitAsync_Helper(1, 10, new TimeSpan(0, 0, Timer.MaxSupportedTimeout), true, null);
91+
RunSemaphoreSlimTest1_WaitAsync_Helper(1, 10, TimeSpan.FromMilliseconds(Timer.MaxSupportedTimeout), true, null);
9292
}
9393

9494
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
@@ -98,7 +98,7 @@ public static void RunSemaphoreSlimTest1_WaitAsync_NegativeCases()
9898
// Invalid timeout
9999
RunSemaphoreSlimTest1_WaitAsync_Helper(10, 10, -10, true, typeof(ArgumentOutOfRangeException));
100100
RunSemaphoreSlimTest1_WaitAsync_Helper
101-
(10, 10, new TimeSpan(0, 0, Timer.MaxSupportedTimeout + 1), true, typeof(ArgumentOutOfRangeException));
101+
(10, 10, TimeSpan.FromMilliseconds(Timer.MaxSupportedTimeout + 1), true, typeof(ArgumentOutOfRangeException));
102102
RunSemaphoreSlimTest1_WaitAsync2();
103103
}
104104

0 commit comments

Comments
 (0)