From 74c2ab8588fea48ab5abe70967205187e95db0ae Mon Sep 17 00:00:00 2001 From: Jacob Alber Date: Tue, 31 Mar 2026 09:59:55 -0400 Subject: [PATCH] test: Make the OffThread Delay test more nimble --- .../InProcessExecutionTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs index e01feaaf9f..870d100d76 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs @@ -151,7 +151,10 @@ public class InProcessExecutionTests bool messageSent = await run.TrySendMessageAsync(new TurnToken(emitEvents: true)); messageSent.Should().BeTrue("TurnToken should be accepted"); - Thread.Sleep(TimeSpan.FromSeconds(2)); + while (await run.GetStatusAsync() != RunStatus.Idle) + { + await Task.Delay(200); + } // Collect events List events = [];