Skip to content

Add Eventually polling assertions for eventually-consistent scenarios #3263

Open

Description

@dennisdoomen

Integration tests against message queues, background workers, file watchers or UI state often need to wait until an assertion eventually passes. Today people hand-roll retry loops or pull in a separate library (Awaitility-style).

Proposed API:

await Eventually.Satisfy(() => queue.Count.Should().Be(3), within: 5.Seconds(), checkEvery: 100.Milliseconds());

It would repeatedly evaluate the assertion action, swallowing failures until it passes or the timeout expires, then rethrow the last failure. The internal IClock/ITimer abstraction can drive this testably. Relates to the TimeProvider idea (separate issue) for deterministic testing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationfeature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions