Replace Moq with NSubstitute for unit tests#566
Conversation
|
@greptileai review |
|
/review |
Code Review by Qodo
|
Greptile SummaryThis PR completes the migration from Moq to NSubstitute across all 68 test files in Confidence Score: 5/5Safe to merge — test-only change, no production code modified, migration is correct and complete. All 68 changed files are in the test project. Moq is cleanly removed, NSubstitute patterns are used correctly throughout (Arg.Any, ArgAt, Received, ThrowsAsync, ReturnsForAnyArgs). The three new helper classes are well-designed. The only findings are P2 style suggestions: the DynamicInvoke exception-wrapping concern and the LoggerVerificationExtensions argument-guard suggestion. Neither blocks merge. No files require special attention. The DynamicInvoke pattern in QBitServiceFixture (and its siblings) and the LoggerVerificationExtensions argument check are minor style suggestions only. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Test File] --> B{Needs HTTP mocking?}
B -->|Yes| C[FakeHttpMessageHandler\nCaptures requests\nConfigurable responses]
B -->|No| D{Needs ILogger\nverification?}
D -->|Yes| E[LoggerVerificationExtensions\nReceivedLogContaining\nDidNotReceiveLogContaining]
D -->|No| F{Shared xUnit\nfixture?}
F -->|Yes| G[SubstituteHelper.ClearPendingArgSpecs\nin fixture constructor]
F -->|No| H[Standard NSubstitute\nSubstitute.For / Arg.Any\nReceived / ThrowsAsync]
G --> H
C --> H
E --> H
H --> I{DryRunInterceptor\nneeded?}
I -->|Execute delegate\nunit tests| J[DynamicInvoke pattern\nQBit/Deluge/etc. fixtures]
I -->|Skip action\nintegration tests| K[ReturnsForAnyArgs\nTask.CompletedTask]
Reviews (2): Last reviewed commit: "fixed a few more things" | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
/review |
|
Persistent review updated to latest commit 70b332a |
|
@greptileai review |
No description provided.