Skip to content

Comments

feat: Add missed 16-parameter overloads in ReturnsExtensions#18

Merged
DrBarnabus merged 1 commit intomainfrom
missing-returns-overload
Aug 8, 2025
Merged

feat: Add missed 16-parameter overloads in ReturnsExtensions#18
DrBarnabus merged 1 commit intomainfrom
missing-returns-overload

Conversation

@DrBarnabus
Copy link
Owner

@DrBarnabus DrBarnabus commented Aug 8, 2025

Summary by CodeRabbit

  • New Features

    • Added support for mocking methods with up to sixteen parameters for both Task and ValueTask return types.
  • Tests

    • Introduced new unit tests to verify correct handling and return values for methods with sixteen parameters.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

Walkthrough

Support for methods with sixteen parameters has been added to both the ReturnsExtensions class and its associated unit tests. This includes new extension methods for handling Task<TResult> and ValueTask<TResult> return types, as well as corresponding tests and interface updates to validate correct argument passing and result handling.

Changes

Cohort / File(s) Change Summary
Sixteen-Parameter Returns Extension Methods
src/Mimic/Extensions/ReturnsExtensions.cs
Added new extension methods to handle mocked methods with sixteen parameters for both Task<TResult> and ValueTask<TResult>. Updated XML documentation and remarks to reflect the new maximum parameter count.
Sixteen-Parameter Unit Tests and Interface Updates
src/Mimic.UnitTests/Extensions/ReturnsExtensionsTests.cs
Added tests for sixteen-parameter methods on ISubject for both Task<int> and ValueTask<int>. Updated the ISubject interface to include these new method signatures and implemented corresponding test logic.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Unit Test
    participant Mock as Mocked ISubject
    participant ReturnsExt as ReturnsExtensions

    Test->>Mock: Setup Task/ValueTask method with 16 params
    Mock->>ReturnsExt: Use Returns extension with 16-param Func
    Test->>Mock: Invoke method with 16 arguments
    Mock->>ReturnsExt: Pass arguments to Func
    ReturnsExt-->>Mock: Return Task/ValueTask with result
    Mock-->>Test: Return result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Poem

Sixteen carrots in a row,
Each with a task or value to show.
Extensions now stretch far and wide,
With tests that hop on every side.
A rabbit cheers this lengthy feat—
More parameters, still oh-so neat! 🥕✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch missing-returns-overload

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Base automatically changed from final-xmldocs to main August 8, 2025 21:12
@DrBarnabus DrBarnabus force-pushed the missing-returns-overload branch from 77cced4 to da85792 Compare August 8, 2025 21:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Mimic/Extensions/ReturnsExtensions.cs (1)

419-447: Doc consistency: update earlier remark stating “up to 15 parameters” to 16

Now that 16-parameter overloads exist (and System.Func supports up to 16 inputs), please update the earlier remarks that still say “up to 15 parameters”.

Suggested diffs:

-    /// Additional overloads are available for methods with up to 15 parameters following the same pattern.
+    /// Additional overloads are available for methods with up to 16 parameters following the same pattern.

Apply in both places:

  • Task: lines 93–95 (three-argument overload’s remarks)
  • ValueTask: lines 539–541 (three-argument overload’s remarks)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8860046 and da85792.

📒 Files selected for processing (2)
  • src/Mimic.UnitTests/Extensions/ReturnsExtensionsTests.cs (4 hunks)
  • src/Mimic/Extensions/ReturnsExtensions.cs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Prepare (windows-latest)
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (8)
src/Mimic/Extensions/ReturnsExtensions.cs (4)

419-451: 16-parameter Task overload added correctly

Implementation matches existing pattern, correctly threads all 16 args into valueFunction and wraps via Task.FromResult.


412-413: Minor doc change looks fine

No functional impact; content remains consistent with the other overloads.


865-897: 16-parameter ValueTask overload added correctly

All 16 parameters are correctly threaded; result is wrapped via new ValueTask(...). Good parity with Task overload.


858-859: Minor doc change looks fine

No issues; consistent with neighbouring overloads.

src/Mimic.UnitTests/Extensions/ReturnsExtensionsTests.cs (4)

359-387: Task 16-parameter test is correct and thorough

Verifies each argument is passed through and asserts the returned value. Mirrors prior tests; good coverage for new overload.


744-772: ValueTask 16-parameter test is correct and thorough

Asserts all 16 args and the result; consistent with the Task variant.


810-811: ISubject.Task 16-parameter overload added

Signature is consistent with existing series and required for the new test.


844-845: ISubject.ValueTask 16-parameter overload added

Signature is consistent and enables the new test.

@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.39%. Comparing base (8860046) to head (da85792).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #18   +/-   ##
=======================================
  Coverage   92.38%   92.39%           
=======================================
  Files          64       64           
  Lines        2115     2117    +2     
  Branches      365      365           
=======================================
+ Hits         1954     1956    +2     
  Misses         84       84           
  Partials       77       77           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DrBarnabus DrBarnabus merged commit 6ab9869 into main Aug 8, 2025
18 checks passed
@DrBarnabus DrBarnabus deleted the missing-returns-overload branch August 8, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant