fix: incorrect nullability for indexer parameters#316
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect nullability annotations for indexer parameters in the verification API. The parameters array was previously marked as nullable (NamedParameter?[]) when it should have been non-nullable (NamedParameter[]), since NamedParameter is a struct and cannot be null.
Key changes:
- Corrected parameter type from
NamedParameter?[]toNamedParameter[]in indexer verification methods - Simplified parameter matching logic by removing unnecessary null checks
- Updated indexer expectation messages to include brackets around parameters for clarity
- Added test coverage for multi-parameter indexer verification scenarios
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Source/Mockolate/Mock.Verify.cs | Updated parameter types in GotIndexer and SetIndexer methods |
| Source/Mockolate/MockRegistration.Verify.cs | Removed null checks and simplified parameter matching logic for indexer verification |
| Source/Mockolate/Verify/VerificationResultExtensions.cs | Removed unused code path for IHasMockRegistration |
| Tests/Mockolate.Tests/Verify/VerificationResultTests.cs | Added tests for multi-parameter indexer verification and updated expectation format |
| Tests/Mockolate.Api.Tests/Expected/*.txt | Updated API surface snapshots to reflect corrected parameter nullability |
|
🚀 Benchmark ResultsDetails
|
|
This is addressed in release v0.45.0. |



This PR fixes incorrect nullability annotations for indexer parameters in the verification API. The parameters array was previously marked as nullable (
NamedParameter?[]) when it should have been non-nullable (NamedParameter[]), sinceNamedParameteris a struct and cannot be null.Key changes:
NamedParameter?[]toNamedParameter[]in indexer verification methods