-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: compare name of method and indexer parameters #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 pull request enhances parameter matching by adding support for comparing parameter names in addition to their values. The implementation changes method invocation tracking from using simple value arrays to using named tuples containing both parameter names and values.
Changes:
- Modified method invocations to include parameter names alongside values using tuples
(string? Name, object? Value) - Updated parameter matching logic to verify both parameter names and values
- Adjusted source generators to emit code with named parameter tuples
- Updated API surface and test files to reflect the new signature
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/Mockolate.Tests/MockMethods/SetupMethodTests.cs | Updated test invocations to use named parameter tuples |
| Tests/Mockolate.Tests/MockMethods/SetupMethodTests.OutRefParameterTests.cs | Updated test invocations to use named parameter tuples |
| Tests/Mockolate.Tests/MockMethods/InteractionsTests.cs | Updated test invocations to use named parameter tuples |
| Tests/Mockolate.Tests/MatchTests.ParametersTests.cs | Added System.Linq import and updated test to transform values into named tuples |
| Tests/Mockolate.Tests/MatchTests.AnyParametersTests.cs | Added System.Linq import and updated test to transform values into named tuples |
| Tests/Mockolate.SourceGenerators.Tests/Sources/MockClassTests.cs | Updated expected generated code to include parameter names |
| Tests/Mockolate.SourceGenerators.Tests/Sources/ForMockTests.ImplementClassTests.cs | Updated expected generated code to include parameter names |
| Tests/Mockolate.SourceGenerators.Tests/Sources/ForMockTests.DelegateTests.cs | Updated expected generated code to include parameter names |
| Tests/Mockolate.SourceGenerators.Tests/GeneralTests.cs | Updated expected generated code to include parameter names |
| Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt | Updated API surface with TupleElementNames attributes for new signatures |
| Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt | Updated API surface with TupleElementNames attributes for new signatures |
| Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt | Updated API surface with TupleElementNames attributes for new signatures |
| Source/Mockolate/Setup/VoidMethodSetup.cs | Updated to access parameter values via .Value property |
| Source/Mockolate/Setup/ReturnMethodSetup.cs | Updated to access parameter values via .Value property |
| Source/Mockolate/Setup/MethodSetup.cs | Enhanced matching logic to compare parameter names when provided |
| Source/Mockolate/Parameters/IParameters.cs | Changed signature to accept named parameter tuples |
| Source/Mockolate/MockRegistration.cs | Updated InvokeMethod signatures and implementation to use named parameter tuples |
| Source/Mockolate/MockRegistration.Verify.cs | Enhanced verification logic to compare parameter names |
| Source/Mockolate/Match.Parameters.cs | Updated to accept predicates over named parameter tuples |
| Source/Mockolate/Match.AnyParameters.cs | Updated to accept named parameter tuples |
| Source/Mockolate/Interactions/MethodInvocation.cs | Changed to store and display named parameter tuples |
| Source/Mockolate.SourceGenerators/Sources/Sources.MethodSetups.cs | Updated generated code to access parameter values via .Value property |
| Source/Mockolate.SourceGenerators/Sources/Sources.ForMock.cs | Updated to generate method invocations with named parameter tuples |
🚀 Benchmark ResultsDetails
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated no new comments.
0f8657b to
9d11c6b
Compare
|
|
This is addressed in release v0.52.0. |



This pull request enhances parameter matching by adding support for comparing parameter names in addition to their values. The implementation changes method and indexer invocation tracking from using simple value arrays to using
NamedParameterValuescontaining both parameter names and values.Key Changes:
NamedParameterValuesNamedParameterValues