cs-testing

Generate and fix C#/.NET xUnit tests with NSubstitute or Moq.

7|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/chenziyang110/spec-kit-plus --skill cs-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cs-testing
Source: https://github.com/chenziyang110/spec-kit-plus/tree/main/templates/passive-skills/cs-testing
Command: npx skills add https://github.com/chenziyang110/spec-kit-plus --skill cs-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you write or repair correct C# tests for .NET projects, so failures are diagnosed quickly and coverage improves without brittle or flaky test suites.

Core Features & Use Cases

  • Test-first workflow: guides you through a RED → GREEN → REFACTOR loop to minimize changes while restoring correctness.
  • Modern .NET testing stack: produces xUnit.net tests using NSubstitute (preferred) or Moq (legacy) plus FluentAssertions for readable assertions.
  • Failure and coverage support: structures unit and integration tests, including edge cases and async behavior, and improves how you run and filter tests.

Quick Start

Use the cs-testing skill when you have a specific failing test request for a .NET class or you want new xUnit/NSubstitute tests for a C# component.

Frequently Asked Questions about cs-testing

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

FAQPage Schema
How do I generate xUnit tests for a C# .NET 8 project?

You can generate xUnit tests for C# .NET 8 by analyzing your project layout and applying a phased approach that outputs compilable test code using FluentAssertions and NSubstitute. The process designs deterministic test cases with async safety.

What is the best way to fix failing or flaky C# unit tests?

Fixing failing or flaky C# unit tests is best handled through a RED, GREEN, REFACTOR workflow that diagnoses test failures and stabilizes flaky tests. This approach restores correctness while minimizing changes to your existing code.

Can I use Moq instead of NSubstitute for C# test generation?

Yes, you can use Moq instead of NSubstitute for C# test generation. NSubstitute is preferred, but Moq is supported for legacy scenarios, and both integrate with FluentAssertions to produce readable test assertions.

Why does my dotnet test command fail to run generated xUnit tests?

Your dotnet test command might fail if generated xUnit tests are not compilable or lack async safety. This Skill ensures test code compiles correctly and provides exact dotnet test commands to run and filter your test suite.

Does this C# testing approach support integration tests and edge cases?

Yes, this C# testing approach supports integration tests and edge cases. It structures unit and integration tests, including edge cases and async behavior, to improve overall coverage without producing brittle test suites.