We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d5da9c commit 7461631Copy full SHA for 7461631
src/Testing/test/TaskExtensionsTest.cs
@@ -2,6 +2,7 @@
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
4
using System;
5
+using System.Threading;
6
using System.Threading.Tasks;
7
using Xunit;
8
@@ -12,7 +13,9 @@ public class TaskExtensionsTest
12
13
[Fact]
14
public async Task TimeoutAfterTest()
15
{
- await Assert.ThrowsAsync<TimeoutException>(async () => await Task.Delay(1000).TimeoutAfter(TimeSpan.FromMilliseconds(50)));
16
+ var cts = new CancellationTokenSource();
17
+ await Assert.ThrowsAsync<TimeoutException>(async () => await Task.Delay(30000, cts.Token).TimeoutAfter(TimeSpan.FromMilliseconds(50)));
18
+ cts.Cancel();
19
}
20
21
0 commit comments