From abd0ccaf499217422a58fca8ed301cb6e40bfbdc Mon Sep 17 00:00:00 2001 From: Brennan Date: Fri, 19 Mar 2021 12:47:06 -0700 Subject: [PATCH] Use longer delay in test --- src/Testing/test/TaskExtensionsTest.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Testing/test/TaskExtensionsTest.cs b/src/Testing/test/TaskExtensionsTest.cs index f7ad603df551..c6508fa6994e 100644 --- a/src/Testing/test/TaskExtensionsTest.cs +++ b/src/Testing/test/TaskExtensionsTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Threading; using System.Threading.Tasks; using Xunit; @@ -12,7 +13,9 @@ public class TaskExtensionsTest [Fact] public async Task TimeoutAfterTest() { - await Assert.ThrowsAsync(async () => await Task.Delay(1000).TimeoutAfter(TimeSpan.FromMilliseconds(50))); + var cts = new CancellationTokenSource(); + await Assert.ThrowsAsync(async () => await Task.Delay(30000, cts.Token).TimeoutAfter(TimeSpan.FromMilliseconds(50))); + cts.Cancel(); } } }