Skip to content

feat: add It.IsNotNull and It.IsNotOneOf#627

Merged
vbreuss merged 2 commits into
mainfrom
topic/add-itisnotnull-and-itisnotoneof
Apr 5, 2026
Merged

feat: add It.IsNotNull and It.IsNotOneOf#627
vbreuss merged 2 commits into
mainfrom
topic/add-itisnotnull-and-itisnotoneof

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Apr 5, 2026

Adds new parameter matchers to Mockolate’s It API (IsNotNull and IsNotOneOf) and corresponding tests/API snapshots to extend the strongly-typed matcher surface.

Changes:

  • Add It.IsNotNull<T>(...) matcher and tests.
  • Add It.IsNotOneOf<T>(...) matcher (with .Using(IEqualityComparer<T>)) and tests.
  • Update public API baselines; includes an additional change to It.IsOneOf<T>(...) signature.

@vbreuss vbreuss self-assigned this Apr 5, 2026
@vbreuss vbreuss added the enhancement New feature or request label Apr 5, 2026
Copilot AI review requested due to automatic review settings April 5, 2026 08:48
Copy link
Copy Markdown

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

Adds new parameter matchers to Mockolate’s It API (IsNotNull and IsNotOneOf) and corresponding tests/API snapshots to extend the strongly-typed matcher surface.

Changes:

  • Add It.IsNotNull<T>(...) matcher and tests.
  • Add It.IsNotOneOf<T>(...) matcher (with .Using(IEqualityComparer<T>)) and tests.
  • Update public API baselines; includes an additional change to It.IsOneOf<T>(...) signature.

Reviewed changes

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

Show a summary per file
File Description
Tests/Mockolate.Tests/ItTests.IsNotOneOfTests.cs New tests covering matching behavior, covariance in setup/verify, comparer usage, and ToString() for IsNotOneOf.
Tests/Mockolate.Tests/ItTests.IsNotNullTests.cs New tests covering IsNotNull matching and ToString() behavior (default/custom).
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt API baseline updated for new IsNotNull/IsNotOneOf and updated IsOneOf signature.
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Same API baseline updates for net8.0.
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Same API baseline updates for net10.0.
Source/Mockolate/It.IsOneOf.cs Changes IsOneOf to accept IEnumerable<T> (via params-collection syntax) and updates matcher to store IEnumerable<T>.
Source/Mockolate/It.IsNotOneOf.cs New IsNotOneOf matcher implementation + IIsNotOneOfParameter<T> interface and .Using(...) support.
Source/Mockolate/It.IsNotNull.cs New IsNotNull matcher implementation with customizable ToString().

Comment thread Source/Mockolate/It.IsOneOf.cs Outdated
Comment thread Source/Mockolate/It.IsNotOneOf.cs
Comment thread Source/Mockolate/It.IsOneOf.cs
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2026

Test Results

    21 files  ±  0      21 suites  ±0   7m 38s ⏱️ + 2m 23s
 3 035 tests + 23   3 034 ✅ + 23  1 💤 ±0  0 ❌ ±0 
20 388 runs  +161  20 387 ✅ +161  1 💤 ±0  0 ❌ ±0 

Results for commit 027d474. ± Comparison against base commit 746c415.

♻️ This comment has been updated with latest results.

@vbreuss vbreuss enabled auto-merge (squash) April 5, 2026 08:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.64GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), 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
Indexer_Mockolate 891.7 ns 6.55 ns 6.13 ns 1.00 0.01 0.1564 - 2.56 KB 1.00
Indexer_Moq 184,136.8 ns 559.00 ns 522.89 ns 206.51 1.49 0.7324 0.4883 14.57 KB 5.69
Indexer_NSubstitute 6,085.1 ns 39.67 ns 35.16 ns 6.82 0.06 0.5722 - 9.41 KB 3.67
Indexer_FakeItEasy 6,283.2 ns 22.31 ns 20.87 ns 7.05 0.05 0.4883 0.0153 8.03 KB 3.13
Indexer_Imposter 773.7 ns 7.29 ns 6.08 ns 0.87 0.01 0.2928 0.0048 4.8 KB 1.87
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.64GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), 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
Method_Mockolate 698.2 ns 9.63 ns 9.01 ns 1.00 0.02 0.1326 - 2.17 KB 1.00
Method_Moq 184,352.4 ns 453.01 ns 423.75 ns 264.07 3.31 0.7324 0.4883 14.59 KB 6.72
Method_NSubstitute 5,848.9 ns 39.08 ns 36.56 ns 8.38 0.12 0.5493 0.0076 9.09 KB 4.18
Method_FakeItEasy 6,305.3 ns 34.49 ns 28.80 ns 9.03 0.12 0.4883 0.0153 8.05 KB 3.71
Method_Imposter 594.1 ns 5.86 ns 5.20 ns 0.85 0.01 0.2537 0.0029 4.15 KB 1.91
Method_TUnitMocks 732.9 ns 8.47 ns 7.92 ns 1.05 0.02 0.1774 0.0010 2.9 KB 1.33
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.64GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), 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
Property_Mockolate 480.1 ns 2.27 ns 2.12 ns 1.00 0.01 0.0801 - 1.32 KB 1.00
Property_Moq 4,797.9 ns 17.50 ns 15.51 ns 9.99 0.05 0.3281 - 5.48 KB 4.15
Property_NSubstitute 5,066.9 ns 54.88 ns 51.34 ns 10.55 0.11 0.5188 0.0076 8.58 KB 6.50
Property_FakeItEasy 4,501.2 ns 78.42 ns 73.36 ns 9.38 0.15 0.3815 0.0153 6.35 KB 4.81
Property_Imposter 372.6 ns 4.36 ns 4.08 ns 0.78 0.01 0.1783 0.0019 2.91 KB 2.21
Property_TUnitMocks 521.0 ns 4.27 ns 3.78 ns 1.09 0.01 0.1249 - 2.05 KB 1.56
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.64GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), 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 373.7 ns 2.35 ns 2.20 ns 1.00 0.01 0.0658 - 1.08 KB 1.00
Event_Moq 16,542.7 ns 82.74 ns 77.39 ns 44.27 0.32 0.7629 - 12.57 KB 11.66
Event_NSubstitute 5,689.6 ns 23.34 ns 21.83 ns 15.22 0.10 0.5569 0.0076 9.17 KB 8.51
Event_FakeItEasy 216,589.2 ns 1,982.80 ns 1,854.71 ns 579.57 5.83 0.7324 0.4883 15.26 KB 14.16
Event_Imposter 1,350.2 ns 31.58 ns 26.37 ns 3.61 0.07 0.5379 0.0153 8.8 KB 8.17
Event_TUnitMocks 179.6 ns 2.73 ns 2.42 ns 0.48 0.01 0.0837 0.0002 1.37 KB 1.27
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.64GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), 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 464.8 ns 3.87 ns 3.43 ns 1.00 0.01 0.1049 - 1.72 KB 1.00
Callback_Moq 95,698.5 ns 407.16 ns 380.85 ns 205.90 1.67 0.4883 0.2441 8.88 KB 5.17
Callback_NSubstitute 4,424.9 ns 39.49 ns 35.01 ns 9.52 0.10 0.4730 0.0076 7.74 KB 4.50
Callback_FakeItEasy 4,896.8 ns 75.75 ns 70.85 ns 10.54 0.17 0.4120 0.0153 6.81 KB 3.96
Callback_Imposter 443.1 ns 18.88 ns 17.66 ns 0.95 0.04 0.1454 0.0010 2.38 KB 1.39
Callback_TUnitMocks 640.6 ns 16.45 ns 15.39 ns 1.38 0.03 0.1602 0.0010 2.63 KB 1.53

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 5, 2026

@vbreuss vbreuss merged commit 3c67756 into main Apr 5, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/add-itisnotnull-and-itisnotoneof branch April 5, 2026 09:05
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

This is addressed in release v2.4.0.

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