Skip to content

Comments

docs: add documentation for Mock.Wrap#427

Merged
vbreuss merged 2 commits intomainfrom
topic/improve-documentation-1
Jan 30, 2026
Merged

docs: add documentation for Mock.Wrap#427
vbreuss merged 2 commits intomainfrom
topic/improve-documentation-1

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Jan 30, 2026

This PR adds documentation for the Mock.Wrap<T>() feature, which enables wrapping existing instances with mock tracking capabilities. The documentation explains that this feature forwards calls to real instances while still allowing interaction verification.

Changes:

  • Added "Wrapping Existing Instances" section with usage examples
  • Documented constraints and behavior of Mock.Wrap<T>()
  • Included notes about interface-only support and setup override capabilities

## Changes

- Added "Wrapping Existing Instances" subsection to README.md and Docs/pages/01-create-mocks.md
- Documented that Mock.Wrap forwards calls to real instances while tracking interactions
- Clarified that only interface types can be wrapped
- Added example showing wrapping, invocation, and verification
@vbreuss vbreuss self-assigned this Jan 30, 2026
Copilot AI review requested due to automatic review settings January 30, 2026 17:57
@vbreuss vbreuss added the documentation Improvements or additions to documentation label Jan 30, 2026
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 adds documentation for the Mock.Wrap<T>() feature, which enables wrapping existing instances with mock tracking capabilities. The documentation explains that this feature forwards calls to real instances while still allowing interaction verification.

Changes:

  • Added "Wrapping Existing Instances" section with usage examples
  • Documented constraints and behavior of Mock.Wrap<T>()
  • Included notes about interface-only support and setup override capabilities

Reviewed changes

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

File Description
README.md Added wrapping documentation section with example and usage notes
Docs/pages/01-create-mocks.md Added corresponding wrapping documentation to the create-mocks documentation page

@vbreuss vbreuss enabled auto-merge (squash) January 30, 2026 18:01
@sonarqubecloud
Copy link

@github-actions
Copy link

github-actions bot commented Jan 30, 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.102
[Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), 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.694 μs 0.0355 μs 0.0332 μs 0.2270 - 3.73 KB
Simple_Moq 179.733 μs 1.5851 μs 1.4051 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.601 μs 0.0223 μs 0.0174 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.305 μs 0.1971 μs 0.1844 μs 0.4959 - 8.11 KB

@github-actions
Copy link

Test Results

    21 files  ±0      21 suites  ±0   5m 25s ⏱️ -28s
 2 517 tests ±0   2 516 ✅ ±0  1 💤 ±0  0 ❌ ±0 
16 800 runs  ±0  16 799 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 8d80d28. ± Comparison against base commit 17879ef.

@vbreuss vbreuss merged commit 7a62be5 into main Jan 30, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/improve-documentation-1 branch January 30, 2026 18:04
@github-actions
Copy link

This is addressed in release v1.1.0.

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

Labels

documentation Improvements or additions to documentation state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Mock.Wrap feature

1 participant