Skip to content

coverage: add missing tests for async result verification#499

Merged
vbreuss merged 1 commit intomainfrom
topic/add-coverage-for-async-verification
Feb 28, 2026
Merged

coverage: add missing tests for async result verification#499
vbreuss merged 1 commit intomainfrom
topic/add-coverage-for-async-verification

Conversation

@vbreuss
Copy link
Copy Markdown
Contributor

@vbreuss vbreuss commented Feb 28, 2026

Adds missing coverage around async verification results in Mockolate’s verification API, while also adjusting the async verification loop and updating API baselines to reflect a removed helper.

Key Changes:

  • Add new tests validating IAsyncVerificationResult.VerifyAsync(...) success behavior and that Within(...)/WithCancellation(...) return an async-capable verification result.
  • Adjust async verification loop behavior in VerificationResult<T>.Awaitable.VerifyAsync(...).
  • Remove MethodSetup.Matches(...) and update API snapshot expectations accordingly.

@vbreuss vbreuss self-assigned this Feb 28, 2026
Copilot AI review requested due to automatic review settings February 28, 2026 19:09
@vbreuss vbreuss added the coverage Additional tests for edge cases or improvement of test coverage label Feb 28, 2026
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

Adds missing coverage around async verification results in Mockolate’s verification API, while also adjusting the async verification loop and updating API baselines to reflect a removed helper.

Changes:

  • Add new tests validating IAsyncVerificationResult.VerifyAsync(...) success behavior and that Within(...)/WithCancellation(...) return an async-capable verification result.
  • Adjust async verification loop behavior in VerificationResult<T>.Awaitable.VerifyAsync(...).
  • Remove MethodSetup.Matches(...) and update API snapshot expectations accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/Mockolate.Tests/Verify/VerificationResultTests.AsyncTests.cs Adds async-result verification tests and type assertions for async verification results.
Source/Mockolate/Verify/VerificationResult.cs Changes the async verification wait loop behavior.
Source/Mockolate/Setup/MethodSetup.cs Removes a protected static helper that was part of the public surface for derived setups.
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt Updates expected API surface after removing MethodSetup.Matches(...).
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Updates expected API surface after removing MethodSetup.Matches(...).
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Updates expected API surface after removing MethodSetup.Matches(...).
Comments suppressed due to low confidence (1)

Source/Mockolate/Setup/MethodSetup.cs:149

  • Removing protected static Matches(NamedParameter[] ..., NamedParameterValue[] ...) from MethodSetup is a public API breaking change for any external derived setups. If the intent is only to remove an internal helper, consider keeping it (potentially [Obsolete]) until a major version bump, or moving it to an internal helper type so consumers aren’t broken unexpectedly.
	/// <summary>
	///     Triggers the parameter callbacks for each value in the specified array according to
	///     the corresponding named parameter.
	/// </summary>
	protected static void TriggerCallbacks(NamedParameter?[] namedParameters, object?[] values)

Comment thread Tests/Mockolate.Tests/Verify/VerificationResultTests.AsyncTests.cs
@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss enabled auto-merge (squash) February 28, 2026 19:14
@github-actions
Copy link
Copy Markdown

Test Results

    21 files  ± 0      21 suites  ±0   5m 26s ⏱️ +7s
 2 796 tests + 3   2 795 ✅ + 3  1 💤 ±0  0 ❌ ±0 
18 789 runs  +21  18 788 ✅ +21  1 💤 ±0  0 ❌ ±0 

Results for commit d7f6875. ± Comparison against base commit e4100c8.

This pull request removes 1 and adds 4 tests. Note that renamed tests count towards both.
Mockolate.Tests.Verify.VerificationResultTests+AsyncTests ‑ WhenAlreadySuccessful_ShouldSucceed
Mockolate.Tests.Verify.VerificationResultTests+AsyncTests ‑ VerifyAsync_WhenAlreadySuccessful_ShouldReturnTrue
Mockolate.Tests.Verify.VerificationResultTests+AsyncTests ‑ VerifyAsync_WhenMultipleIterationsAreNecessary_ShouldStopWhenSuccessful
Mockolate.Tests.Verify.VerificationResultTests+AsyncTests ‑ WithCancellation_ShouldReturnAsyncVerificationResult
Mockolate.Tests.Verify.VerificationResultTests+AsyncTests ‑ Within_ShouldReturnAsyncVerificationResult

@vbreuss vbreuss merged commit 39ce56d into main Feb 28, 2026
16 checks passed
@vbreuss vbreuss deleted the topic/add-coverage-for-async-verification branch February 28, 2026 19:14
@github-actions
Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.87GHz, 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

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.520 μs 0.0181 μs 0.0169 μs 0.2460 - 4.02 KB
Simple_Moq 177.708 μs 0.6684 μs 0.5582 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.906 μs 0.0436 μs 0.0408 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.514 μs 0.0330 μs 0.0292 μs 0.4959 - 8.11 KB

@github-actions
Copy link
Copy Markdown

This is addressed in release v1.5.0.

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

Labels

coverage Additional tests for edge cases or improvement of test coverage state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants