Skip to content

Commit 7461631

Browse files
Use longer delay in test (#31072)
1 parent 2d5da9c commit 7461631

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Testing/test/TaskExtensionsTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Threading;
56
using System.Threading.Tasks;
67
using Xunit;
78

@@ -12,7 +13,9 @@ public class TaskExtensionsTest
1213
[Fact]
1314
public async Task TimeoutAfterTest()
1415
{
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();
1619
}
1720
}
1821
}

0 commit comments

Comments
 (0)