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 = [];