refactor: fix the documentation for For(int)#291
Conversation
There was a problem hiding this comment.
Pull request overview
This PR corrects documentation for the For(int) method across the Mockolate codebase. The previous documentation incorrectly stated that For(int) "limits" or "only executes" a callback/return/throw for a given number of times, when it actually "repeats" the behavior for that number of times. The PR also updates the implementation to directly pass the times parameter instead of using a lambda predicate, and fixes several formatting inconsistencies in XML documentation comments.
Key changes:
- Updated documentation from "Limits...to only execute" to "Repeats" for all
For(int)method overloads - Changed implementation calls from
For(x => x < times)toFor(times) - Refactored the
Callbackclass to useint?field instead ofFunc<int, bool>?predicate - Fixed line wrapping and formatting in various XML documentation comments
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Source/Mockolate/Setup/VoidMethodSetup.cs | Updated For(int) implementations to pass times directly; removed nullable annotations on callback variables |
| Source/Mockolate/Setup/ReturnMethodSetup.cs | Updated For(int) implementations to pass times directly; removed nullable annotations on callback variables |
| Source/Mockolate/Setup/PropertySetup.cs | Updated For(int) implementations to pass times directly |
| Source/Mockolate/Setup/Interfaces.PropertySetup.cs | Corrected documentation from "Limits" to "Repeats" for property setup For(int) methods |
| Source/Mockolate/Setup/Interfaces.MethodSetup.cs | Corrected documentation from "Limits" to "Repeats" for all method setup For(int) methods across multiple generic overloads |
| Source/Mockolate/Setup/Interfaces.IndexerSetup.cs | Corrected documentation from "Limits" to "Repeats" for indexer setup For(int) methods; fixed line wrapping in multiple XML comments |
| Source/Mockolate/Setup/IndexerSetup.cs | Updated For(int) implementations to pass times directly; improved line wrapping in inheritdoc comments |
| Source/Mockolate/Setup/Callback.cs | Replaced Func<int, bool>? predicate with int? field; updated implementation logic from lambda to direct comparison |
| Source/Mockolate.SourceGenerators/Sources/Sources.MethodSetups.cs | Updated source generator templates to emit corrected documentation and implementation for generated method setups |
| Source/Mockolate.SourceGenerators/Sources/Sources.IndexerSetups.cs | Updated source generator templates to emit corrected documentation and improved line wrapping for generated indexer setups |
For(int)For(int)
|
🚀 Benchmark ResultsDetails
|
|
This is addressed in release v0.43.0. |



This PR corrects documentation for the
For(int)method across the Mockolate codebase. The previous documentation incorrectly stated thatFor(int)"limits" or "only executes" a callback/return/throw for a given number of times, when it actually "repeats" the behavior for that number of times. The PR also updates the implementation to directly pass thetimesparameter instead of using a lambda predicate, and fixes several formatting inconsistencies in XML documentation comments.Key changes:
For(int)method overloadsFor(x => x < times)toFor(times)Callbackclass to useint?field instead ofFunc<int, bool>?predicate