Skip to content

Comments

Document Mock.Wrap feature#412

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/document-mock-wrap-feature
Closed

Document Mock.Wrap feature#412
Copilot wants to merge 2 commits intomainfrom
copilot/document-mock-wrap-feature

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

The Mock.Wrap<T>() API was undocumented despite being fully implemented and tested.

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

Example

var realDispenser = new ChocolateDispenser();
var wrappedDispenser = Mock.Wrap<IChocolateDispenser>(realDispenser);

// Calls forwarded to real instance
wrappedDispenser.Dispense("Dark", 5);

// Interactions still tracked
wrappedDispenser.VerifyMock.Invoked.Dispense(It.Is("Dark"), It.Is(5)).Once();
Original prompt

This section details on the original issue you should resolve

<issue_title>Document Mock.Wrap feature</issue_title>
<issue_description>## Description

The Mock.Wrap<T>(instance) feature is completely missing from the README.md documentation.

Missing Documentation

  • Mock.Wrap<T>(instance) - Wrap existing instances with mock tracking
  • Forward calls to real instance while tracking interactions
  • Verify interactions on wrapped instances

Suggested Documentation

Add a new subsection under "Create mocks" titled "Wrapping Existing Instances":

### Wrapping Existing Instances
You can wrap an existing instance with mock tracking using `Mock.Wrap<T>()`. This allows you to track interactions with a real object:

with the following example

var realDispenser = new ChocolateDispenser();
var wrappedDispenser = Mock.Wrap<IChocolateDispenser>(realDispenser);

// Calls are forwarded to the real instance
wrappedDispenser.Dispense(\"Dark\", 5);

// But you can still verify interactions
wrappedDispenser.VerifyMock.Invoked.Dispense(It.Is(\"Dark\"), It.Is(5)).Once();
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: vbreuss <3438234+vbreuss@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for Mock.Wrap feature Document Mock.Wrap feature Jan 30, 2026
Copilot AI requested a review from vbreuss January 30, 2026 17:32
@vbreuss
Copy link
Contributor

vbreuss commented Jan 30, 2026

Obsolete by #427

@vbreuss vbreuss closed this Jan 30, 2026
@vbreuss vbreuss deleted the copilot/document-mock-wrap-feature branch January 31, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Mock.Wrap feature

2 participants