dotnet-testing-nsubstitute-mocking

Community

Master NSubstitute mocking in .NET tests.

Authorkevintsengtw
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill teaches how to use NSubstitute to create and manage test doubles (mocks, stubs, spies) to isolate dependencies, control behavior, and verify interactions in unit tests.

Core Features & Use Cases

  • Substitute.For: create interface or class substitutes for isolation.
  • Returns/Received/Throws: configure return values, verify calls, and throw exceptions.
  • Test Double Patterns: dummy, stub, fake, spy, and mock exemplified with representative examples.
  • Use Case: validate a service's behavior without real dependencies in a xUnit-based project.

Quick Start

Install the required NuGet packages in your test project (NSubstitute, xUnit, Microsoft.Extensions.Logging) and adapt the examples to your domain models.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: dotnet-testing-nsubstitute-mocking
Download link: https://github.com/kevintsengtw/dotnet-testing-agent-skills/archive/main.zip#dotnet-testing-nsubstitute-mocking

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.