Radberi-TestingAntiPatterns

Guide .NET developers to avoid testing anti-patterns like mock behavior verification.

1|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/primeBeri/huml-dotnet --skill radberi-testingantipatterns-primeberi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Radberi-TestingAntiPatterns
Source: https://github.com/primeBeri/huml-dotnet/tree/main/.claude/skills/Radberi-TestingAntiPatterns
Command: npx skills add https://github.com/primeBeri/huml-dotnet --skill radberi-testingantipatterns-primeberi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps developers understand how to write effective tests by avoiding common anti-patterns that lead to unreliable or unsafe test practices.

Core Features & Use Cases

  • Identify and prevent mock behaviour testing to ensure tests verify real component actions.
  • Promote proper separation of test utilities and production code, preventing pollution with test-only methods.
  • Guide the correct use of mocks and dependencies to accurately simulate real scenarios and avoid false test pass states.
  • Use case: Improve test reliability in a .NET application by replacing complex mocks with actual in-memory or containerized services, ensuring tests accurately reflect real-world behaviors.

Quick Start

Review best practices for unit testing, including how to write realistic mocks and avoid testing mock behaviour, using in-memory databases or test containers instead of over-mocking dependencies.

Frequently Asked Questions about Radberi-TestingAntiPatterns

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

FAQPage Schema
What is testing mock behaviour and why is it considered a test anti-pattern?

Avoid testing mock behaviour by replacing complex mocks with actual in-memory databases or containerized services. Use mocks strictly for external dependencies to ensure tests accurately reflect real-world behaviors rather than validating mock interactions.

How do I write reliable unit tests without over-mocking dependencies?

Over-mocking dependencies creates false test pass states by validating mock interactions rather than actual business logic. It reduces test reliability by disconnecting tests from real-world behaviors, making refactoring risky and test failures misleading.

When should I use in-memory databases or test containers instead of mocks?

Prevent test-only method pollution by maintaining strict separation between production code and test utilities. Never add test-specific methods or exposure to your production classes, as this compromises code safety and violates clean dependency management practices.

What are the best practices for separating test utilities from production code?

Use in-memory databases or test containers instead of mocks when verifying complex dependencies that require real-world behavior simulation. This approach ensures tests reflect actual component actions rather than mock interactions, improving overall test reliability.

Can I improve test reliability in .NET applications by replacing mocks with real services?

Replace complex mocks with in-memory databases or containerized services to improve test reliability. This ensures tests accurately reflect real-world behaviors and prevents false pass states caused by testing mock behaviour instead of actual component actions.