Skip to content

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Jan 17, 2026

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 NamedParameterValues containing both parameter names and values.

Key Changes:

  • Modified method invocations to include parameter names alongside values using NamedParameterValues
  • Modified indexer get and set access to include parameter names alongside values using NamedParameterValues
  • Updated parameter matching logic to verify both parameter names and values
  • Adjusted source generators to emit code with named parameters
  • Updated API surface and test files to reflect the new signature

@vbreuss vbreuss self-assigned this Jan 17, 2026
Copilot AI review requested due to automatic review settings January 17, 2026 06:25
@vbreuss vbreuss added the enhancement New feature or request label Jan 17, 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 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

@github-actions
Copy link

github-actions bot commented Jan 17, 2026

Test Results

    14 files  ±0      14 suites  ±0   5m 55s ⏱️ +40s
 2 166 tests +1   2 165 ✅ +1  1 💤 ±0  0 ❌ ±0 
14 497 runs  +7  14 496 ✅ +7  1 💤 ±0  0 ❌ ±0 

Results for commit 9d11c6b. ± Comparison against base commit ecb3045.

♻️ This comment has been updated with latest results.

@vbreuss vbreuss enabled auto-merge (squash) January 17, 2026 06:30
@github-actions
Copy link

github-actions bot commented Jan 17, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
Intel Xeon Platinum 8370C CPU 2.80GHz (Max: 3.18GHz), 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-v4

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.512 μs 0.0271 μs 0.0253 μs 0.1507 - 3.73 KB
Simple_Moq 134.470 μs 0.6240 μs 0.5837 μs 0.4883 0.2441 14.56 KB
Simple_NSubstitute 5.530 μs 0.0541 μs 0.0506 μs 0.3662 - 9.14 KB
Simple_FakeItEasy 5.858 μs 0.0314 μs 0.0262 μs 0.3281 - 8.12 KB

Copilot AI review requested due to automatic review settings January 17, 2026 10:47
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

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

@vbreuss vbreuss changed the title feat: compare name of method parameters feat: compare name of method and indexer parameters Jan 17, 2026
Copilot AI review requested due to automatic review settings January 17, 2026 12:20
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

Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings January 17, 2026 12:51
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

Copilot reviewed 38 out of 38 changed files in this pull request and generated no new comments.

@vbreuss vbreuss force-pushed the topic/verify-name-of-method-parameters branch from 0f8657b to 9d11c6b Compare January 17, 2026 15:58
@sonarqubecloud
Copy link

@vbreuss vbreuss merged commit 8ac302f into main Jan 17, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/verify-name-of-method-parameters branch January 17, 2026 16:04
@github-actions
Copy link

This is addressed in release v0.52.0.

@github-actions github-actions bot added the state: released The issue is released label Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants