feat: support Within in verification expectations#73
Conversation
There was a problem hiding this comment.
Pull request overview
Adds opt-in time-bounded (“Within”) verification support for Mockolate VerificationResult expectations by introducing a new AndOrWithinResult wrapper + WithinOptions, updating relevant constraints to run async verification, and extending the test suite to cover background-invocation scenarios.
Changes:
- Introduces
AndOrWithinResult+WithinOptionsto enable.Within(...)and improved cancellation handling for verification expectations. - Updates
ThatVerificationResultconstraints (Once/Twice/Exactly/AtLeast*/Times/Between) to support async verification viaIAsyncVerificationResult. - Expands/adjusts tests and API snapshots; adds
aweXpect.Chronologyfor time helpers in tests.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.cs | Removes unused usings; keeps shared test interface container. |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.TwiceTests.cs | Adds background/Within/WithTimeout coverage for Twice(). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.TimesTests.cs | Adds background/Within/WithTimeout coverage for Times(...). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.ThenTests.cs | Formatting adjustments for multiline assertions. |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.OnceTests.cs | Adds background/Within/WithTimeout coverage for Once(). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.NeverTests.cs | Reorders/refines Never() test cases and messages. |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.ExactlyTests.cs | Adds background/Within/WithTimeout coverage for Exactly(times). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.BetweenTests.cs | Adds background/Within/WithTimeout coverage for Between(min).And(max). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtMostTwiceTests.cs | Minor refactor/reorder of AtMostTwice() tests. |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtMostTests.cs | Reorders test cases and normalizes local function bodies. |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtMostOnceTests.cs | Reorders/refines AtMostOnce() test cases and messages. |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastTwiceTests.cs | Adds background/Within/WithTimeout coverage for AtLeastTwice(). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastTests.cs | Adds background/Within/WithTimeout coverage for AtLeast(times). |
| Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastOnceTests.cs | Adds background/Within/WithTimeout coverage for AtLeastOnce(). |
| Tests/aweXpect.Mockolate.Tests/ThatMockVerifyIs.AllSetupsAreUsedTests.cs | Reorders tests and adjusts negated-case coverage/messages. |
| Tests/aweXpect.Mockolate.Tests/ThatMockVerifyIs.AllInteractionsAreVerifiedTests.cs | Reorders tests and adjusts negated-case coverage/messages. |
| Tests/aweXpect.Mockolate.Api.Tests/Expected/aweXpect.Mockolate_netstandard2.0.txt | Updates public API snapshot for new result/options types and return types. |
| Tests/aweXpect.Mockolate.Api.Tests/Expected/aweXpect.Mockolate_net8.0.txt | Updates public API snapshot for new result/options types and return types. |
| Tests/aweXpect.Mockolate.Api.Tests/Expected/aweXpect.Mockolate_net10.0.txt | Updates public API snapshot for new result/options types and return types. |
| Tests/Directory.Build.props | Adds aweXpect.Chronology reference for tests. |
| Source/aweXpect.Mockolate/ThatVerificationResult.cs | Adds async constraint support and shared ToAmountString helper placement. |
| Source/aweXpect.Mockolate/ThatVerificationResult.Twice.cs | Changes Twice() to return AndOrWithinResult and wire WithinOptions. |
| Source/aweXpect.Mockolate/ThatVerificationResult.Times.cs | Changes Times(...) to return AndOrWithinResult and support async verification. |
| Source/aweXpect.Mockolate/ThatVerificationResult.Once.cs | Changes Once() to return AndOrWithinResult and wire WithinOptions. |
| Source/aweXpect.Mockolate/ThatVerificationResult.Never.cs | Adapts to new constraint ctor signature (options), without exposing Within. |
| Source/aweXpect.Mockolate/ThatVerificationResult.Exactly.cs | Changes Exactly(times) to return AndOrWithinResult and wire WithinOptions. |
| Source/aweXpect.Mockolate/ThatVerificationResult.Between.cs | Changes Between(...).And(...) to return AndOrWithinResult and support async verification. |
| Source/aweXpect.Mockolate/ThatVerificationResult.AtMostTwice.cs | Formatting-only signature layout change. |
| Source/aweXpect.Mockolate/ThatVerificationResult.AtMostOnce.cs | Formatting-only signature layout change. |
| Source/aweXpect.Mockolate/ThatVerificationResult.AtMost.cs | Formatting-only doc/signature spacing changes. |
| Source/aweXpect.Mockolate/ThatVerificationResult.AtLeastTwice.cs | Changes AtLeastTwice() to return AndOrWithinResult and wire WithinOptions. |
| Source/aweXpect.Mockolate/ThatVerificationResult.AtLeastOnce.cs | Changes AtLeastOnce() to return AndOrWithinResult and wire WithinOptions. |
| Source/aweXpect.Mockolate/ThatVerificationResult.AtLeast.cs | Changes AtLeast(times) to return AndOrWithinResult and wire WithinOptions. |
| Source/aweXpect.Mockolate/Results/AndOrWithinResult.cs | New result wrapper that adds .Within(...) and typed .WithCancellation(...). |
| Source/aweXpect.Mockolate/Options/WithinOptions.cs | New options container for within-timeout + cancellation token. |
| Directory.Packages.props | Updates dependency versions; adds aweXpect.Chronology. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.TimesTests.cs
Outdated
Show resolved
Hide resolved
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.TimesTests.cs
Outdated
Show resolved
Hide resolved
🚀 Benchmark ResultsDetails
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastOnceTests.cs
Show resolved
Hide resolved
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastTwiceTests.cs
Show resolved
Hide resolved
|
|
This is addressed in release v1.2.0. |



Adds opt-in time-bounded (“Within”) verification support for Mockolate
VerificationResultexpectations by introducing a newAndOrWithinResultwrapper +WithinOptions, updating relevant constraints to run async verification, and extending the test suite to cover background-invocation scenarios.Key Changes:
AndOrWithinResult+WithinOptionsto enable.Within(...)and improved cancellation handling for verification expectations.ThatVerificationResultconstraints (Once/Twice/Exactly/AtLeast*/Times/Between) to support async verification viaIAsyncVerificationResult.aweXpect.Chronologyfor time helpers in tests..Within(TimeSpan timeout)#67