Skip to content

refactor: simplify PropertySetup#400

Merged
vbreuss merged 1 commit into
mainfrom
topic/propertysetup-coverage
Jan 24, 2026
Merged

refactor: simplify PropertySetup#400
vbreuss merged 1 commit into
mainfrom
topic/propertysetup-coverage

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Jan 24, 2026

This PR simplifies the PropertySetup class by removing redundant logic and improving test coverage for callback handling.

Key Changes:

  • Removed unnecessary foundCallback tracking variable in InvokeGetter
  • Simplified conditional logic for value initialization
  • Added tests for MethodSetupResult.TriggerCallbacks with null parameters
  • Improved test coverage for parameter callback invocation scenarios

@vbreuss vbreuss self-assigned this Jan 24, 2026
Copilot AI review requested due to automatic review settings January 24, 2026 21: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 simplifies the PropertySetup class by removing redundant logic and improving test coverage for callback handling.

Changes:

  • Removed unnecessary foundCallback tracking variable in InvokeGetter
  • Simplified conditional logic for value initialization
  • Added tests for MethodSetupResult.TriggerCallbacks with null parameters
  • Improved test coverage for parameter callback invocation scenarios

Reviewed changes

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

File Description
Source/Mockolate/Setup/PropertySetup.cs Removed redundant foundCallback variable and simplified initialization logic in InvokeGetter and InitializeValue
Tests/Mockolate.Tests/MockMethods/SetupMethodTests.cs Added tests for null parameter handling and parameter callback invocation with matching/non-matching counts

@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss enabled auto-merge (squash) January 24, 2026 21:28
@github-actions
Copy link
Copy Markdown

Test Results

    21 files  ± 0      21 suites  ±0   7m 46s ⏱️ + 1m 12s
 2 379 tests + 2   2 378 ✅ + 2  1 💤 ±0  0 ❌ ±0 
15 946 runs  +14  15 945 ✅ +14  1 💤 ±0  0 ❌ ±0 

Results for commit adc78ad. ± Comparison against base commit 198f8cb.

This pull request removes 1 and adds 3 tests. Note that renamed tests count towards both.
Mockolate.Tests.MockMethods.SetupMethodTests ‑ TriggerCallbacks_ArrayLengthDoesNotMatch_ShouldNotThrow
Mockolate.Tests.MockMethods.SetupMethodTests ‑ MethodSetupResult_TriggerCallbacks_Null_ShouldTriggerCallbacksWithNullArray
Mockolate.Tests.MockMethods.SetupMethodTests ‑ TriggerCallbacks_WhenParameterCountDoesNotMatch_ShouldNotInvokeParameterCallbacks
Mockolate.Tests.MockMethods.SetupMethodTests ‑ TriggerCallbacks_WhenParameterCountMatches_ShouldInvokeParameterCallbacks

@vbreuss vbreuss merged commit 6ae56f2 into main Jan 24, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/propertysetup-coverage branch January 24, 2026 21:28
@github-actions
Copy link
Copy Markdown

🚀 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.102
[Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), 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.589 μs 0.0142 μs 0.0126 μs 0.2270 - 3.73 KB
Simple_Moq 180.212 μs 0.7719 μs 0.6446 μs 0.4883 - 14.77 KB
Simple_NSubstitute 5.745 μs 0.0206 μs 0.0172 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.490 μs 0.0190 μs 0.0159 μs 0.4959 - 8.11 KB

@github-actions
Copy link
Copy Markdown

This is addressed in release v1.0.3.

@github-actions github-actions Bot added the state: released The issue is released label Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants