fluentassertions / fluentassertions/fluentassertions

Add `Eventually` polling assertions for eventually-consistent scenarios

Open
#3,263 0 comments 0 reactions 0 assignees View on GitHub
api-suggestion feature
Dominant language
C#
Stars
3.8k
Forks
720
Avg merge
1d 1h
Merged PRs (30d)
29

Description

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:

```csharp
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.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing IClock and ITimer abstractions and the assertion execution conventions. Review how timeout and assertion failures are currently represented, then determine the API and deterministic test coverage needed for Eventually.Satisfy. Done means the proposed polling behavior, timeout handling, and last-failure propagation are specified and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.