Skip to content

fix: add a TODO for a Times argument the Moq code fix cannot translate - #96

Open
vbreuss wants to merge 1 commit into
mainfrom
fix/todo-for-untranslated-constructs
Open

vbreuss wants to merge 1 commit into
mainfrom
fix/todo-for-untranslated-constructs

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 18, 2026

Copy link
Copy Markdown
Member

When the Times argument of Verify was not a literal Times.X expression, the fixer left the Moq call on the migrated mock without a hint, and VerifyGet/VerifySet/VerifyAdd/VerifyRemove silently fell back to AtLeastOnce(), which turns e.g. a Times.Never() variable into a weaker assertion. All five now keep the original call and add // TODO(MockolateM001): translate the Times argument '<expr>' manually.

  • A string second argument is Moq's fail message, not a Times argument, and still migrates to AtLeastOnce() (Moq's default); for Verify this was previously left untouched.
  • The NSubstitute fixer has no such approximation: Received(n) maps to Exactly(n) for any expression.

@vbreuss vbreuss self-assigned this Oct 18, 2026
Copilot AI balanced review requested due to automatic review settings October 18, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vbreuss
vbreuss added this pull request to stack #99 October 18, 2026 18:22
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Test Results

 12 files   12 suites   15m 19s ⏱️
294 tests 294 ✅ 0 💤 0 ❌
882 runs  882 ✅ 0 💤 0 ❌

Results for commit e7d432d.

♻️ This comment has been updated with latest results.

When the `Times` argument of `Verify` was not a literal `Times.X` expression, the fixer left the Moq call on the migrated mock without a hint, and `VerifyGet`/`VerifySet`/`VerifyAdd`/`VerifyRemove` silently fell back to `AtLeastOnce()`, which turns e.g. a `Times.Never()` variable into a weaker assertion. All five now keep the original call and add `// TODO(MockolateM001): translate the Times argument '<expr>' manually`.

- A `string` second argument is Moq's fail message, not a `Times` argument, and still migrates to `AtLeastOnce()` (Moq's default); for `Verify` this was previously left untouched.
- The NSubstitute fixer has no such approximation: `Received(n)` maps to `Exactly(n)` for any expression.
Copilot AI balanced review requested due to automatic review settings October 18, 2026 23:46
@vbreuss
vbreuss force-pushed the fix/todo-for-untranslated-constructs branch from 8c6fc47 to e7d432d Compare October 18, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

2 participants