Skip to content

Comments

refactor: remove duplicate code in VerificationResult#315

Merged
vbreuss merged 1 commit intomainfrom
topic/improve-coverage
Dec 13, 2025
Merged

refactor: remove duplicate code in VerificationResult#315
vbreuss merged 1 commit intomainfrom
topic/improve-coverage

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Dec 13, 2025

This PR refactors the VerificationResult<TVerify> class by removing duplicate code and simplifying its implementation. The key change is making properties explicitly implemented via the IVerificationResult interface rather than maintaining both explicit and implicit implementations.

Key changes:

  • Converted Expectation property from public to explicit interface implementation backed by a private field
  • Removed duplicate Verify method that was identical to the interface implementation
  • Added test coverage for MockInteractions and various edge cases in related components

@vbreuss vbreuss self-assigned this Dec 13, 2025
Copilot AI review requested due to automatic review settings December 13, 2025 13:07
@vbreuss vbreuss added the coverage Additional tests for edge cases or improvement of test coverage label Dec 13, 2025
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

This PR refactors the VerificationResult<TVerify> class by removing duplicate code and simplifying its implementation. The key change is making properties explicitly implemented via the IVerificationResult interface rather than maintaining both explicit and implicit implementations.

Key changes:

  • Converted Expectation property from public to explicit interface implementation backed by a private field
  • Removed duplicate Verify method that was identical to the interface implementation
  • Added test coverage for MockInteractions and various edge cases in related components

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Source/Mockolate/Verify/VerificationResult.cs Refactored to use explicit interface implementation for Expectation and removed duplicate Verify method
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt Updated API surface to reflect removal of public Expectation property and Verify method
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Updated API surface to reflect removal of public Expectation property and Verify method
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Updated API surface to reflect removal of public Expectation property and Verify method
Tests/Mockolate.Tests/Verify/VerificationResultTests.cs Added test to verify MockInteractions property exposes all mock interactions
Tests/Mockolate.Tests/MockEvents/RaiseTests.cs Added test to verify raising events without registration doesn't throw
Tests/Mockolate.Tests/ItTests.IsOneOfTests.cs Reorganized tests alphabetically and added test for Using method
Tests/Mockolate.Tests/ItTests.IsInRangeTests.cs Added test for Inclusive() method behavior

@vbreuss vbreuss enabled auto-merge (squash) December 13, 2025 13:09
@sonarqubecloud
Copy link

@github-actions
Copy link

Test Results

    14 files  ± 0      14 suites  ±0   4m 40s ⏱️ -27s
 1 683 tests +10   1 682 ✅ +10  1 💤 ±0  0 ❌ ±0 
11 238 runs  +70  11 237 ✅ +70  1 💤 ±0  0 ❌ ±0 

Results for commit 902f6d3. ± Comparison against base commit 91bec3d.

@vbreuss vbreuss merged commit 3abcf45 into main Dec 13, 2025
12 checks passed
@vbreuss vbreuss deleted the topic/improve-coverage branch December 13, 2025 13:13
@github-actions
Copy link

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.79GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.101
[Host] : .NET 10.0.1 (10.0.1, 10.0.125.57005), 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.440 μs 0.0073 μs 0.0065 μs 0.2232 - 3.66 KB
Simple_Moq 172.485 μs 2.0584 μs 1.8247 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.471 μs 0.0201 μs 0.0188 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.172 μs 0.0131 μs 0.0122 μs 0.4959 - 8.11 KB

@github-actions
Copy link

This is addressed in release v0.45.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.

1 participant