Path: redb-route/tests/redb.Route.Tests.WebSocket/TestWait.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.WebSocket/TestWait.cs ---- namespace redb.Route.Tests.WebSocket; /// /// Waits for a condition instead of a fixed pause. A fixed pause is too short on a slow machine and makes the /// test fail at random; this wait ends as soon as the condition holds. /// internal static class TestWait { /// /// Polls every 20 ms until it returns true or elapses. /// At the timeout it simply returns, so the assertion that follows fails with its own message. /// public static async Task Until(Func done, int timeoutMs = 10_000) { var deadline = DateTime.UtcNow.AddMilliseconds(timeoutMs); while (!done() && DateTime.UtcNow < deadline) await Task.Delay(20); } }