Skip to content

feat: support Within in verification expectations#73

Merged
vbreuss merged 4 commits intomainfrom
topic/support-within
Mar 6, 2026
Merged

feat: support Within in verification expectations#73
vbreuss merged 4 commits intomainfrom
topic/support-within

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Mar 6, 2026

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.

Key Changes:

  • Introduces AndOrWithinResult + WithinOptions to enable .Within(...) and improved cancellation handling for verification expectations.
  • Updates ThatVerificationResult constraints (Once/Twice/Exactly/AtLeast*/Times/Between) to support async verification via IAsyncVerificationResult.
  • Expands/adjusts tests and API snapshots; adds aweXpect.Chronology for time helpers in tests.

@vbreuss vbreuss self-assigned this Mar 6, 2026
Copilot AI review requested due to automatic review settings March 6, 2026 14:41
@vbreuss vbreuss added the enhancement New feature or request label Mar 6, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Test Results

    8 files  ±  0      8 suites  ±0   45s ⏱️ +41s
  189 tests + 53    188 ✅ + 53  1 💤 ±0  0 ❌ ±0 
1 256 runs  +371  1 255 ✅ +371  1 💤 ±0  0 ❌ ±0 

Results for commit 5c1aff3. ± Comparison against base commit acd16ee.

♻️ This comment has been updated with latest results.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + WithinOptions to enable .Within(...) and improved cancellation handling for verification expectations.
  • Updates ThatVerificationResult constraints (Once/Twice/Exactly/AtLeast*/Times/Between) to support async verification via IAsyncVerificationResult.
  • Expands/adjusts tests and API snapshots; adds aweXpect.Chronology for 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.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.103
[Host] : .NET 10.0.3 (10.0.3, 10.0.326.7603), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.3 (10.0.3, 10.0.326.7603), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Median Allocated
Dummy_aweXpect 0.0002 ns 0.0005 ns 0.0004 ns 0.0 ns -

@vbreuss vbreuss enabled auto-merge (squash) March 6, 2026 16:36
@vbreuss vbreuss disabled auto-merge March 6, 2026 16:37
Copilot AI review requested due to automatic review settings March 6, 2026 16:37
@vbreuss vbreuss enabled auto-merge (squash) March 6, 2026 16:38
@vbreuss vbreuss disabled auto-merge March 6, 2026 16:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vbreuss vbreuss enabled auto-merge (squash) March 6, 2026 16:52
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2026

@vbreuss vbreuss merged commit cb9073d into main Mar 6, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/support-within branch March 6, 2026 16:54
@github-actions github-actions bot added the state: released The issue is released label Mar 6, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

This is addressed in release v1.2.0.

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

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support .Within(TimeSpan timeout)

2 participants