Skip to content

Comments

refactor: fix the documentation for For(int)#291

Merged
vbreuss merged 2 commits intomainfrom
topic/fix-doc-for-for
Dec 10, 2025
Merged

refactor: fix the documentation for For(int)#291
vbreuss merged 2 commits intomainfrom
topic/fix-doc-for-for

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Dec 10, 2025

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) to For(times)
  • Refactored the Callback class to use int? field instead of Func<int, bool>? predicate
  • Fixed line wrapping and formatting in various XML documentation comments

@vbreuss vbreuss self-assigned this Dec 10, 2025
Copilot AI review requested due to automatic review settings December 10, 2025 14:55
@vbreuss vbreuss added the documentation Improvements or additions to documentation label Dec 10, 2025
Copy link

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 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) to For(times)
  • Refactored the Callback class to use int? field instead of Func<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

@vbreuss vbreuss changed the title docs: fix the documentation for For(int) refactor: fix the documentation for For(int) Dec 10, 2025
@vbreuss vbreuss enabled auto-merge (squash) December 10, 2025 14:59
@sonarqubecloud
Copy link

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.88GHz, 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.507 μs 0.0130 μs 0.0116 μs 0.2213 - 3.62 KB
Simple_Moq 180.330 μs 0.8122 μs 0.6341 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.892 μs 0.0287 μs 0.0254 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.448 μs 0.0164 μs 0.0145 μs 0.4959 - 8.11 KB

@github-actions
Copy link

Test Results

    14 files  ±0      14 suites  ±0   4m 46s ⏱️ -16s
 1 505 tests ±0   1 504 ✅ ±0  1 💤 ±0  0 ❌ ±0 
10 024 runs  ±0  10 023 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit ea36c0b. ± Comparison against base commit 1820d7a.

@vbreuss vbreuss merged commit 0a4679d into main Dec 10, 2025
12 checks passed
@vbreuss vbreuss deleted the topic/fix-doc-for-for branch December 10, 2025 15:04
@github-actions
Copy link

This is addressed in release v0.43.0.

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

Labels

documentation Improvements or additions to documentation state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant