Skip to content

coverage: add missing tests for It.*#736

Merged
vbreuss merged 1 commit into
mainfrom
topic/add-missing-tests-for-`It.`
Apr 30, 2026
Merged

coverage: add missing tests for It.*#736
vbreuss merged 1 commit into
mainfrom
topic/add-missing-tests-for-`It.`

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Apr 30, 2026

This pull request adds new unit tests to improve coverage and ensure correct behavior of the It.IsNull, It.IsNotNull, and It.SequenceEquals parameter matchers in the Mockolate testing framework. The most important changes include verifying the use of shared instances, correct string representations, handling of nulls in sequences, and support for multiple callbacks.

Parameter matcher instance behavior:

  • Added tests to verify that It.IsNull<string>() and It.IsNotNull<string>() return shared instances when ToString() is not called, ensuring consistent identity semantics.

String representation and null handling:

  • Added a test to It.SequenceEquals<object?> to ensure that the string representation correctly renders null elements as null tokens in the output.

Callback registration and invocation:

  • Added a test to verify that multiple callbacks registered with ISequenceEqualsParameter<int> are all invoked when the matcher is triggered, improving confidence in the callback mechanism.

@vbreuss vbreuss self-assigned this Apr 30, 2026
@vbreuss vbreuss added the coverage Additional tests for edge cases or improvement of test coverage label Apr 30, 2026
@vbreuss vbreuss enabled auto-merge (squash) April 30, 2026 19:57
@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss disabled auto-merge April 30, 2026 20:05
@vbreuss vbreuss merged commit 6708718 into main Apr 30, 2026
14 checks passed
@vbreuss vbreuss deleted the topic/add-missing-tests-for-`It.` branch April 30, 2026 20:05
@github-actions
Copy link
Copy Markdown

🚀 Benchmark Results

Details

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

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

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Event_Mockolate 365.5 ns 2.73 ns 2.56 ns 1.00 0.01 0.1254 0.0005 2.05 KB 1.00
Event_Moq 16,023.3 ns 64.40 ns 53.78 ns 43.85 0.33 0.7324 - 12.51 KB 6.09
Event_NSubstitute 5,513.2 ns 19.88 ns 18.59 ns 15.09 0.11 0.5493 0.0076 9.05 KB 4.40
Event_FakeItEasy 212,258.9 ns 585.49 ns 519.02 ns 580.81 4.17 0.7324 0.4883 15.39 KB 7.49
Event_Imposter 1,390.6 ns 12.26 ns 10.87 ns 3.81 0.04 0.5379 0.0153 8.8 KB 4.29
Event_TUnitMocks 182.2 ns 1.69 ns 1.58 ns 0.50 0.01 0.0837 0.0002 1.37 KB 0.67
Details

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

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

Method N Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Indexer_Mockolate 1 962.3 ns 9.72 ns 8.62 ns 1.00 0.01 0.2460 0.0019 4.03 KB 1.00
Indexer_Moq 1 217,309.1 ns 1,787.28 ns 1,671.82 ns 225.83 2.57 0.9766 0.4883 20.25 KB 5.02
Indexer_NSubstitute 1 9,431.5 ns 98.40 ns 87.23 ns 9.80 0.12 0.7782 - 12.78 KB 3.17
Indexer_FakeItEasy 1 11,773.3 ns 164.44 ns 153.82 ns 12.23 0.19 0.8392 0.0305 13.88 KB 3.44
Indexer_Imposter 1 1,017.7 ns 48.19 ns 45.08 ns 1.06 0.05 0.3147 0.0038 5.16 KB 1.28
Indexer_Mockolate 10 2,594.6 ns 29.92 ns 27.98 ns 1.00 0.01 0.3090 - 5.09 KB 1.00
Indexer_Moq 10 228,442.0 ns 1,040.39 ns 922.28 ns 88.05 0.98 1.7090 1.4648 28.64 KB 5.63
Indexer_NSubstitute 10 22,291.6 ns 216.48 ns 202.50 ns 8.59 0.12 1.5564 0.0305 25.58 KB 5.03
Indexer_FakeItEasy 10 25,373.4 ns 230.11 ns 215.25 ns 9.78 0.13 2.1667 0.0610 35.47 KB 6.97
Indexer_Imposter 10 2,236.4 ns 82.22 ns 76.91 ns 0.86 0.03 0.4845 0.0076 7.97 KB 1.57
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.81GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v3

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

Method N Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Method_Mockolate 1 491.6 ns 7.03 ns 6.57 ns 1.00 0.02 0.1411 0.0010 2.32 KB 1.00
Method_Moq 1 183,447.2 ns 1,082.42 ns 1,012.50 ns 373.23 5.26 0.4883 - 15.01 KB 6.47
Method_NSubstitute 1 5,886.8 ns 69.29 ns 57.86 ns 11.98 0.19 0.5569 0.0076 9.12 KB 3.93
Method_FakeItEasy 1 6,010.3 ns 63.99 ns 59.85 ns 12.23 0.20 0.4959 - 8.11 KB 3.50
Method_Imposter 1 596.6 ns 15.62 ns 14.61 ns 1.21 0.03 0.2470 0.0029 4.04 KB 1.74
Method_TUnitMocks 1 685.7 ns 9.62 ns 8.53 ns 1.40 0.02 0.1774 0.0010 2.9 KB 1.25
Method_Mockolate 10 754.6 ns 11.58 ns 10.83 ns 1.00 0.02 0.1545 0.0010 2.53 KB 1.00
Method_Moq 10 187,122.0 ns 516.73 ns 483.35 ns 248.03 3.49 0.9766 0.7324 18.92 KB 7.47
Method_NSubstitute 10 8,703.3 ns 121.56 ns 113.71 ns 11.54 0.22 0.7324 0.0153 12.07 KB 4.77
Method_FakeItEasy 10 9,452.1 ns 97.71 ns 91.39 ns 12.53 0.21 0.9766 0.0305 16.05 KB 6.34
Method_Imposter 10 1,233.5 ns 24.71 ns 23.11 ns 1.64 0.04 0.3376 0.0057 5.52 KB 2.18
Method_TUnitMocks 10 1,701.1 ns 27.89 ns 26.09 ns 2.25 0.05 0.2747 0.0019 4.49 KB 1.77
Details

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

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

Method N Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Property_Mockolate 1 584.4 ns 12.71 ns 11.89 ns 1.00 0.03 0.1574 0.0010 2.58 KB 1.00
Property_Moq 1 11,967.4 ns 164.55 ns 153.92 ns 20.48 0.48 0.6104 - 10.39 KB 4.03
Property_NSubstitute 1 7,773.2 ns 115.29 ns 107.85 ns 13.31 0.32 0.6866 - 11.45 KB 4.44
Property_FakeItEasy 1 8,830.4 ns 53.52 ns 50.07 ns 15.11 0.31 0.6866 - 11.24 KB 4.36
Property_Imposter 1 505.7 ns 6.29 ns 5.57 ns 0.87 0.02 0.1907 0.0019 3.13 KB 1.21
Property_TUnitMocks 1 815.2 ns 13.06 ns 12.21 ns 1.40 0.03 0.1526 0.0010 2.51 KB 0.97
Property_Mockolate 10 1,129.4 ns 18.38 ns 17.19 ns 1.00 0.02 0.1869 - 3.07 KB 1.00
Property_Moq 10 19,208.0 ns 40.09 ns 35.53 ns 17.01 0.25 1.0986 - 18.28 KB 5.95
Property_NSubstitute 10 17,978.7 ns 56.31 ns 49.91 ns 15.92 0.24 1.2817 0.0305 21.08 KB 6.87
Property_FakeItEasy 10 20,736.2 ns 145.03 ns 135.66 ns 18.36 0.30 1.8616 - 30.81 KB 10.03
Property_Imposter 10 1,332.1 ns 15.72 ns 13.13 ns 1.18 0.02 0.2842 0.0019 4.67 KB 1.52
Property_TUnitMocks 10 2,320.3 ns 12.31 ns 10.91 ns 2.05 0.03 0.2823 - 4.66 KB 1.52
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 9V74 2.60GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v3

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

Method Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
Callback_Mockolate 416.1 ns 9.67 ns 8.57 ns 1.00 0.03 0.1197 - 1.96 KB 1.00
Callback_Moq 70,712.8 ns 522.36 ns 436.19 ns 170.03 3.63 0.4883 0.2441 8.88 KB 4.53
Callback_NSubstitute 4,272.0 ns 96.34 ns 90.11 ns 10.27 0.30 0.4730 0.0076 7.74 KB 3.95
Callback_FakeItEasy 4,449.9 ns 131.01 ns 122.54 ns 10.70 0.36 0.4120 0.0153 6.81 KB 3.47
Callback_Imposter 426.1 ns 7.24 ns 6.42 ns 1.02 0.03 0.1454 0.0010 2.38 KB 1.22
Callback_TUnitMocks 660.0 ns 8.82 ns 7.82 ns 1.59 0.04 0.1602 0.0010 2.63 KB 1.34

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

Labels

coverage Additional tests for edge cases or improvement of test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant