Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the callback signature order for both property and indexer setups, moving the value parameter to the end for consistency. Previously, property OnSet callbacks received (oldValue, newValue) while indexer callbacks placed the value first. The refactoring standardizes all callbacks to place indexer parameters first, followed by the value parameter last, matching common C# patterns where input parameters precede output/state parameters.
Key Changes
- Property
OnSetcallbacks simplified from(oldValue, newValue)to just(newValue), removing access to the old value - Indexer callback signatures reordered to place the value parameter last:
(TValue, T1, T2, ...)becomes(T1, T2, ..., TValue) - Updated API documentation with detailed remarks explaining parameter order
- Comprehensive test updates reflecting the new signatures
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnSetTests.cs | Updated property setup tests to use new single-parameter OnSet signature, removing old value tracking |
| Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.ReturnsThrowsTests.cs | Updated indexer getter callback tests to reflect parameter reordering (value moved to end) |
| Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnSetTests.cs | Updated indexer setter callback tests with reordered parameters (value moved to end) |
| Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt | Updated API baseline for .NET Standard 2.0 with new callback signatures |
| Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt | Updated API baseline for .NET 8.0 with new callback signatures |
| Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt | Updated API baseline for .NET 10.0 with new callback signatures |
| Source/Mockolate/Setup/PropertySetup.cs | Refactored property setup implementation to remove old value from callbacks and use single-parameter signature |
| Source/Mockolate/Setup/Interfaces.PropertySetup.cs | Updated property setup interface to remove old value parameter from OnSet signatures |
| Source/Mockolate/Setup/Interfaces.IndexerSetup.cs | Updated indexer setup interfaces with reordered parameters and enhanced documentation |
| Source/Mockolate/Setup/IndexerSetup.cs | Refactored indexer setup implementation with new parameter ordering (value moved to end) |
| Source/Mockolate.SourceGenerators/Sources/Sources.IndexerSetups.cs | Updated source generator to produce indexer setups with new parameter ordering |
|
🚀 Benchmark ResultsDetails
|
|
This is addressed in release v0.42.0. |



This PR refactors the callback signature order for both property and indexer setups, moving the value parameter to the end for consistency. Previously, property
OnSetcallbacks received(oldValue, newValue)while indexer callbacks placed the value first. The refactoring standardizes all callbacks to place indexer parameters first, followed by the value parameter last, matching common C# patterns where input parameters precede output/state parameters.Key Changes
OnSetcallbacks simplified from(oldValue, newValue)to just(newValue), removing access to the old value(TValue, T1, T2, ...)becomes(T1, T2, ..., TValue)OnSetwith only one parameter #285