Skip to content

fix: failure message when using Within#86

Merged
vbreuss merged 3 commits into
mainfrom
topic/fix-within-message
Mar 25, 2026
Merged

fix: failure message when using Within#86
vbreuss merged 3 commits into
mainfrom
topic/fix-within-message

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Mar 25, 2026

This PR improves the failure output when Mockolate verifications are used with Within(...) by ensuring timeouts produce aweXpect failure messages that include a useful “Interactions” context, and adds regression tests for the expected messages.

Key Changes:

  • Catch MockVerificationTimeoutException during async verification to convert timeouts into aweXpect constraint failures and attach interactions context.
  • Add new test cases asserting descriptive failure messages for Within(...) across multiple count-based constraints.
  • Update Mockolate package reference from 2.0.0-pre.7 to 2.0.0.

@vbreuss vbreuss self-assigned this Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 07:59
@vbreuss vbreuss added the bug Something isn't working label Mar 25, 2026
@vbreuss vbreuss linked an issue Mar 25, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 25, 2026

Test Results

    8 files  ± 0      8 suites  ±0   50s ⏱️ +4s
  197 tests + 8    196 ✅ + 8  1 💤 ±0  0 ❌ ±0 
1 312 runs  +56  1 311 ✅ +56  1 💤 ±0  0 ❌ ±0 

Results for commit 42d2ff0. ± Comparison against base commit 730514d.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 25, 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.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3

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

Copy link
Copy Markdown

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

This PR improves the failure output when Mockolate verifications are used with Within(...) by ensuring timeouts produce aweXpect failure messages that include a useful “Interactions” context, and adds regression tests for the expected messages.

Changes:

  • Catch MockVerificationTimeoutException during async verification to convert timeouts into aweXpect constraint failures and attach interactions context.
  • Add new test cases asserting descriptive failure messages for Within(...) across multiple count-based constraints.
  • Update Mockolate package reference from 2.0.0-pre.7 to 2.0.0.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.TwiceTests.cs Adds regression test for Twice().Within(...) timeout message content.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.TimesTests.cs Adds regression test for Times(predicate).Within(...) timeout message content.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.OnceTests.cs Adds regression test for Once().Within(...) timeout message content.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.ExactlyTests.cs Adds regression test for Exactly(...).Within(...) and imports aweXpect.Core for n.Times().
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.BetweenTests.cs Adds regression test for Between(...).And(...).Within(...) and imports aweXpect.Core for n.Times().
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastTwiceTests.cs Adds regression test for AtLeastTwice().Within(...) timeout message content.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastTests.cs Adds regression test for AtLeast(n).Within(...) timeout message content.
Tests/aweXpect.Mockolate.Tests/ThatVerificationResultIs.AtLeastOnceTests.cs Adds regression test for AtLeastOnce().Within(...) timeout message content.
Source/aweXpect.Mockolate/ThatVerificationResult.cs Converts async timeout exceptions into constraint failures and ensures “Interactions” context is set/updated.
Source/aweXpect.Mockolate/ThatVerificationResult.Times.cs Same timeout-to-failure handling for predicate-based Times(...) verification.
Source/aweXpect.Mockolate/ThatVerificationResult.Between.cs Same timeout-to-failure handling for Between(...).And(...) verification.
Directory.Packages.props Bumps Mockolate dependency to 2.0.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Source/aweXpect.Mockolate/ThatVerificationResult.cs Outdated
Comment thread Source/aweXpect.Mockolate/ThatVerificationResult.Between.cs Outdated
@vbreuss vbreuss merged commit 7f2d08a into main Mar 25, 2026
8 checks passed
@vbreuss vbreuss deleted the topic/fix-within-message branch March 25, 2026 08:11
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

This is addressed in release v2.0.0.

@github-actions github-actions Bot added the state: released The issue is released label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prepare for 2.0 release

2 participants