Skip to content

Comments

fix: incorrect nullability for indexer parameters#316

Merged
vbreuss merged 1 commit intomainfrom
topic/fix-indexer-nullability
Dec 13, 2025
Merged

fix: incorrect nullability for indexer parameters#316
vbreuss merged 1 commit intomainfrom
topic/fix-indexer-nullability

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Dec 13, 2025

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?[] to NamedParameter[] 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

@vbreuss vbreuss self-assigned this Dec 13, 2025
Copilot AI review requested due to automatic review settings December 13, 2025 13:41
@vbreuss vbreuss added the bug Something isn't working label Dec 13, 2025
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 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?[] to NamedParameter[] 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

@sonarqubecloud
Copy link

@vbreuss vbreuss enabled auto-merge (squash) December 13, 2025 13:44
@github-actions
Copy link

Test Results

    14 files  ± 0      14 suites  ±0   5m 28s ⏱️ + 1m 5s
 1 685 tests + 2   1 684 ✅ + 2  1 💤 ±0  0 ❌ ±0 
11 252 runs  +14  11 251 ✅ +14  1 💤 ±0  0 ❌ ±0 

Results for commit 0b05560. ± Comparison against base commit 3abcf45.

@vbreuss vbreuss merged commit be6e4d5 into main Dec 13, 2025
12 checks passed
@vbreuss vbreuss deleted the topic/fix-indexer-nullability branch December 13, 2025 13:47
@github-actions
Copy link

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.101
[Host] : .NET 10.0.1 (10.0.1, 10.0.125.57005), X64 RyuJIT x86-64-v3

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

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.538 μs 0.0222 μs 0.0208 μs 0.2232 - 3.66 KB
Simple_Moq 186.503 μs 0.7412 μs 0.6190 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.920 μs 0.0422 μs 0.0374 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.683 μs 0.0271 μs 0.0240 μs 0.4959 - 8.11 KB

@github-actions
Copy link

This is addressed in release v0.45.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant