feat: support ref and out parameter migration#19
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support in the Moq → Mockolate code fix to migrate ref/out arguments in Setup/Verify lambda invocations, and expands the test + example coverage to demonstrate the expected migrated output.
Changes:
- Update
MoqCodeFixProviderto transformref/outarguments into Mockolate matchers (It.IsOut,It.IsAnyRef,It.IsRef) before existingMoq.It.*transformations. - Add new code-fix tests covering
outparameters andrefparameters (includingMoq.It.Ref<T>.IsAny). - Replace the previous example test file with a new
MoqMigrationExamplesexample suite.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Tests/Mockolate.Migration.Tests/MoqCodeFixProviderTests.SetupTests.cs | Adds regression tests for ref/out argument migration behavior. |
| Tests/Mockolate.Migration.Example.Tests/MoqMigrationExamples.cs | Introduces updated example code showing expected migrated usage patterns (including ref/out). |
| Tests/Mockolate.Migration.Example.Tests/Examples.cs | Removes older example file in favor of the new consolidated examples. |
| Source/Mockolate.Migration.Analyzers.CodeFixers/MoqCodeFixProvider.cs | Implements ref/out argument rewriting and wires it into Setup/Verify migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
This is addressed in release v0.2.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Adds support in the Moq → Mockolate code fix to migrate
ref/outarguments inSetup/Verifylambda invocations, and expands the test + example coverage to demonstrate the expected migrated output.Changes:
MoqCodeFixProviderto transformref/outarguments into Mockolate matchers (It.IsOut,It.IsAnyRef,It.IsRef) before existingMoq.It.*transformations.outparameters andrefparameters (includingMoq.It.Ref<T>.IsAny).