testing-guide

Guide unit and integration tests for FullStackHero features using xUnit, Shouldly, NSubstitute, and AutoFixture.

6.7k|2.0k|Updated Aug 20, 2021
One-click install
npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill testing-guide-fullstackhero
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-guide
Source: https://github.com/fullstackhero/dotnet-starter-kit/tree/main/.agents/skills/testing-guide
Command: npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill testing-guide-fullstackhero

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures new tests are consistent, readable, and aligned with the project’s .NET testing stack so features stay protected as they evolve.

Core Features & Use Cases

  • xUnit + Shouldly + NSubstitute + AutoFixture conventions: standardizes how tests are named, structured, and asserted.
  • Unit coverage for handlers, validators, and entities: provides templates for the most common testing targets in an FSH feature.
  • Architecture and integration test guardrails: explains what to run and how to keep Architecture.Tests and Integration.Tests reliable (including Docker-based integration requirements).

Quick Start

Add a new handler, validator, or entity test using the provided class/method naming pattern and arrange-act-assert structure, then run the relevant unit tests plus Architecture.Tests.

Frequently Asked Questions about testing-guide

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

FAQPage Schema
How do I write unit tests for .NET handlers and validators using xUnit and Shouldly?

To write unit tests for .NET handlers and validators, apply arrange-act-assert conventions, use Shouldly for assertions, and follow standard class and method naming patterns to ensure tests remain consistent and readable.

How do I set up integration tests for .NET features using Docker Testcontainers?

Set up .NET integration tests using Docker-backed Testcontainers by following project-specific rules in integration-testing.md, ensuring reliable test environments and meeting SignalR long-polling requirements for comprehensive feature validation.

What are .NET architecture tests and when do I need to run them?

.NET architecture tests serve as guardrails verifying your project's structural rules. Run them alongside unit tests after adding handlers, validators, or entities to ensure codebase architecture compliance.

Can I use NSubstitute and AutoFixture together for .NET unit testing?

Yes, you can use NSubstitute and AutoFixture together for .NET unit testing. This combination standardizes how you mock dependencies and generate test data, aligning with the project's testing stack for reliable test creation.

Why do my .NET integration tests fail when SignalR long-polling requirements are not met?

.NET integration tests fail without meeting SignalR long-polling requirements because the testing rules in integration-testing.md mandate specific configurations for Docker-backed Testcontainers to validate real-time features reliably.