fluentassertions / fluentassertions/fluentassertions
Add `Eventually` polling assertions for eventually-consistent scenarios
- 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
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