mock-overload-resolution

Update Moq mock setups for interface method overload signature changes.

18|3|Updated Jul 3, 2020
One-click install
npx skills add https://github.com/jguadagno/jjgnet-broadcast --skill mock-overload-resolution
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-overload-resolution
Source: https://github.com/jguadagno/jjgnet-broadcast/tree/main/.squad/skills/mock-overload-resolution
Command: npx skills add https://github.com/jguadagno/jjgnet-broadcast --skill mock-overload-resolution

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses issues caused by incorrect Moq setup when a managed method's signature changes, preventing silent test failures and false positives.

Core Features & Use Cases

  • Detects signature mismatches between mocked methods and actual interface overloads in unit tests.
  • Guides accurate setup updates by matching the actual method call parameters regardless of overload changes.
  • Use case: When a method's number of parameters changes, this Skill helps update mock setups to avoid false test results and ensure tests accurately reflect code behavior.

Quick Start

Use the mock overload resolution skill to update your Moq setups after changing method signatures in your test files.

Frequently Asked Questions about mock-overload-resolution

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do my Moq unit tests silently pass after changing a method signature in C#?

Moq unit tests silently pass after method signature changes because the mock setup no longer matches the new interface overload, causing the setup to be bypassed without throwing an exception.

How do I update Moq mock setups when an interface method overload changes in .NET?

You update Moq mock setups by matching the actual method call parameters to the new interface overload signature, ensuring the test configuration accurately reflects the changed code behavior and avoids false results.

How does overload resolution mismatch cause false positives in Moq tests?

Overload resolution mismatch causes false positives in Moq tests when a modified method signature bypasses the configured setup entirely, making the test pass silently while the underlying code path remains unverified.

Can I use this Skill to fix unit test maintenance issues with C# method parameters?

You can use this Skill to fix C# unit test maintenance issues by detecting signature mismatches between mocked methods and actual interface overloads, guiding accurate Moq setup updates for new parameters.

What is the best way to prevent silent failures when adding parameters to mocked methods in Moq?

The best way to prevent silent failures when adding parameters to mocked methods is to resolve the overload mismatch by updating the Moq setup to explicitly match the actual method call parameters.

What happens to existing Moq configurations when interface method overloads are modified?

When interface method overloads are modified, existing Moq configurations fail to match the new signatures, leading to silent test failures or false positives that require updating the mock setups to resolve.