Skip to content

refactor!: replace CallBaseClass with SkipBaseClass#353

Merged
vbreuss merged 4 commits intomainfrom
topic/replace-callbaseclass-with-skipbaseclass
Jan 9, 2026
Merged

refactor!: replace CallBaseClass with SkipBaseClass#353
vbreuss merged 4 commits intomainfrom
topic/replace-callbaseclass-with-skipbaseclass

Conversation

@vbreuss
Copy link
Copy Markdown
Contributor

@vbreuss vbreuss commented Jan 9, 2026

This PR refactors the API by replacing the CallBaseClass concept with SkipBaseClass, inverting the boolean logic throughout the codebase. The change makes the API more intuitive by having false (the default) mean "call the base class" and true mean "skip calling the base class."

Key changes

  • Renamed MockBehavior.CallBaseClass to MockBehavior.SkipBaseClass with inverted boolean logic
  • Renamed all setup methods from CallingBaseClass() to SkippingBaseClass() across methods, properties, and indexers
  • Updated test expectations to reflect the inverted logic
  • Updated documentation to describe the new behavior

@vbreuss vbreuss self-assigned this Jan 9, 2026
@vbreuss vbreuss added the breaking change The changes require a new major version label Jan 9, 2026
Copilot AI review requested due to automatic review settings January 9, 2026 07:19
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

This PR refactors the API by replacing the CallBaseClass concept with SkipBaseClass, inverting the boolean logic throughout the codebase. The change makes the API more intuitive by having false (the default) mean "call the base class" and true mean "skip calling the base class."

Key changes:

  • Renamed MockBehavior.CallBaseClass to MockBehavior.SkipBaseClass with inverted boolean logic
  • Renamed all setup methods from CallingBaseClass() to SkippingBaseClass() across methods, properties, and indexers
  • Updated test expectations to reflect the inverted logic
  • Updated documentation to describe the new behavior

Reviewed changes

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

Show a summary per file
File Description
Source/Mockolate/MockBehavior.cs Renamed property from CallBaseClass to SkipBaseClass with updated documentation
Source/Mockolate/MockBehaviorExtensions.cs Renamed extension method from CallingBaseClass() to SkippingBaseClass()
Source/Mockolate/Setup/*.cs Updated all setup classes to use SkipBaseClass with inverted logic
Source/Mockolate/MockRegistration.cs Updated logic to check SkipBaseClass instead of CallBaseClass
Source/Mockolate.SourceGenerators/Sources/*.cs Updated source generators to emit SkipBaseClass code
Tests/**/*.cs Updated all tests to use new API and corrected test expectations for inverted boolean logic
README.md, Docs/**/*.md Updated documentation to reflect the API change

Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.ForMock.cs
Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.ForMock.cs
Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.ForMock.cs
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 9, 2026

Test Results

    14 files  ±0      14 suites  ±0   5m 12s ⏱️ -4s
 1 839 tests ±0   1 838 ✅ ±0  1 💤 ±0  0 ❌ ±0 
12 266 runs  ±0  12 265 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit a664aac. ± Comparison against base commit 10b4bc1.

This pull request removes 65 and adds 65 tests. Note that renamed tests count towards both.
Mockolate.Tests.MockBehaviorExtensionsTests ‑ CallingBaseClass_ShouldSetCallBaseClass
Mockolate.Tests.MockBehaviorExtensionsTests ‑ CallingBaseClass_WithFalse_ShouldUpdateCallBaseClass
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_ForRefAndOutParameter_WhenMethodNotSetup_ShouldUseBaseClassValues
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_ForRefAndOutParameter_WhenMethodSetup_ShouldUseSetupValues
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_WhenIndexerNotSetup_ShouldInitializeIndexerValuesFromBaseClass
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_WhenIndexerSetup_ShouldUseSetupValues
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_WhenMethodNotSetup_ShouldReturnBaseValues
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_WhenMethodSetup_ShouldReturnSetupValues
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_WhenPropertyNotSetup_ShouldInitializePropertyWithValueFromBaseClass
Mockolate.Tests.MockBehaviorTests+BaseClassBehaviorTests ‑ WithCallBaseClass_WhenPropertySetup_ShouldUseSetupValues
…
Mockolate.Tests.MockBehaviorExtensionsTests ‑ SkippingBaseClass_ShouldSetSkipBaseClass
Mockolate.Tests.MockBehaviorExtensionsTests ‑ SkippingBaseClass_WithFalse_ShouldUpdateSkipBaseClass
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_ForRefAndOutParameter_WhenMethodNotSetup_ShouldUseDefaultValues
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_ForRefAndOutParameter_WhenMethodSetup_ShouldUseSetupValues
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_WhenIndexerNotSetup_ShouldInitializeIndexerValuesFromBaseClass
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_WhenIndexerSetup_ShouldUseSetupValues
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_WhenMethodNotSetup_ShouldReturnBaseValues
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_WhenMethodSetup_ShouldReturnSetupValues
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_WhenPropertyNotSetup_ShouldInitializePropertyWithValueFromBaseClass
Mockolate.Tests.MockBehaviorTests+SkippingBaseClassTests ‑ DefaultBehavior_WhenPropertySetup_ShouldUseSetupValues
…

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 9, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.82GHz, 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.587 μs 0.0124 μs 0.0110 μs 0.2270 - 3.72 KB
Simple_Moq 177.286 μs 0.8752 μs 0.7308 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.563 μs 0.0309 μs 0.0289 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.224 μs 0.0248 μs 0.0232 μs 0.4959 - 8.11 KB

Copilot AI review requested due to automatic review settings January 9, 2026 07:30
@vbreuss vbreuss enabled auto-merge (squash) January 9, 2026 07:31
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

Copilot reviewed 40 out of 40 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (4)

Source/Mockolate.SourceGenerators/Sources/Sources.ForMock.cs:1

  • The condition check is incorrect. This should be checking the SkipBaseClass property on the indexer result variable, not calling SkipBaseClass as a method on the string variable name. It should be: if (! + indexerResultVarName + .SkipBaseClass)
using System.Text;

Source/Mockolate/Setup/Interfaces.MethodSetup.cs:1

  • The documentation states "If not specified, use MockBehavior.SkipBaseClass" but this is slightly ambiguous. Consider clarifying to: "If not specified, the value from MockBehavior.SkipBaseClass is used." The same issue appears in other interface files.
using System;

Source/Mockolate/Setup/Interfaces.PropertySetup.cs:1

  • Same documentation ambiguity as in the method setup interfaces. Consider clarifying to: "If not specified, the value from MockBehavior.SkipBaseClass is used."
using System;

Source/Mockolate/Setup/Interfaces.IndexerSetup.cs:1

  • Same documentation ambiguity as in other setup interfaces. Consider clarifying to: "If not specified, the value from MockBehavior.SkipBaseClass is used."
using System;

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 9, 2026

@vbreuss vbreuss merged commit 84b9735 into main Jan 9, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/replace-callbaseclass-with-skipbaseclass branch January 9, 2026 07:38
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 9, 2026

This is addressed in release v0.50.0.

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

Labels

breaking change The changes require a new major version state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants