refactor: remove duplicate code in VerificationResult#315
Conversation
There was a problem hiding this comment.
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
Expectationproperty from public to explicit interface implementation backed by a private field - Removed duplicate
Verifymethod that was identical to the interface implementation - Added test coverage for
MockInteractionsand 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 |
|
🚀 Benchmark ResultsDetails
|
|
This is addressed in release v0.45.0. |



This PR refactors the
VerificationResult<TVerify>class by removing duplicate code and simplifying its implementation. The key change is making properties explicitly implemented via theIVerificationResultinterface rather than maintaining both explicit and implicit implementations.Key changes:
Expectationproperty from public to explicit interface implementation backed by a private fieldVerifymethod that was identical to the interface implementationMockInteractionsand various edge cases in related components