refactor: simplify InvokeGetter in PropertySetup#402
Conversation
There was a problem hiding this comment.
Pull request overview
The PR simplifies the InvokeGetter method in PropertySetup by removing redundant initialization logic that was previously handling type mismatches. The code now relies solely on the initialization that occurs in the if (factory is not null) block above.
Changes:
- Removed fallback initialization logic from
InvokeGetterthat attempted to usedefaultValueGeneratorwhen_isInitializedwas false - Removed corresponding test
InitializeValue_NotMatchingTypes_ShouldUseDefaultthat validated the removed behavior
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 initialization code path from InvokeGetter method |
| Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.cs | Removed test validating the removed initialization behavior |
|
Test Results 21 files ±0 21 suites ±0 5m 58s ⏱️ -57s Results for commit fb6ad62. ± Comparison against base commit e8b8d93. This pull request removes 1 test. |
🚀 Benchmark ResultsDetails
|
|
This is addressed in release v1.0.3. |



The PR simplifies the
InvokeGettermethod inPropertySetupby removing redundant initialization logic that was previously handling type mismatches. The code now relies solely on the initialization that occurs in theif (factory is not null)block above.Key Changes:
InvokeGetterthat attempted to usedefaultValueGeneratorwhen_isInitializedwas falseInitializeValue_NotMatchingTypes_ShouldUseDefaultthat validated the removed behavior