dotnet-testing-preferences

Generate .NET tests using xUnit v3, NSubstitute, Shouldly, and TestContainers.

Updated Oct 22, 2024
One-click install
npx skills add https://github.com/DigiBanks99/dotfiles --skill dotnet-testing-preferences
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-testing-preferences
Source: https://github.com/DigiBanks99/dotfiles/tree/main/modules/agents/.config/.agents/skills/dotnet-testing-preferences
Command: npx skills add https://github.com/DigiBanks99/dotfiles --skill dotnet-testing-preferences

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers write, improve, review, or extend tests in a .NET codebase (unit, integration, and end-to-end). It promotes the standardized testing stack and structure—xUnit v3, NSubstitute, Shouldly, and TestContainers—to produce reliable, production-aligned tests and easier maintenance.

Core Features & Use Cases

  • Standardized test structure across unit and integration tests, focusing on public APIs and observable behavior.
  • Use xUnit v3 for tests, NSubstitute for mocks, Shouldly for assertions, and TestContainers for realistic integration infra.
  • Production-aligned organization and naming conventions (ThingTests and MethodName_StateUnderTest) to improve readability and maintainability.

Quick Start

Ask me to generate .NET tests following the dotnet-testing-preferences conventions.

Frequently Asked Questions about dotnet-testing-preferences

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

FAQPage Schema
How do I structure .NET tests using xUnit and NSubstitute for better maintainability?

You can standardize .NET integration tests using TestContainers to provision realistic infrastructures. This skill generates tests validating behavior via public APIs, applying TestContainers alongside xUnit v3 to ensure reliable, production-aligned integration testing.

What is the best way to group assertions in xUnit v3 tests?

Yes, Shouldly works with xUnit v3 for .NET test assertions. This skill uses Shouldly to generate standardized test code that validates behavior via public APIs, improving assertion readability and maintaining consistency across unit and integration tests.

Does TestContainers support integration testing for .NET projects?

TestContainers supports integration testing for .NET projects by provisioning realistic infrastructures. This skill applies TestContainers alongside xUnit v3 to generate integration tests that validate behavior via public APIs, ensuring reliable, production-aligned testing.

How do I name .NET unit tests to improve readability?

To improve .NET unit test readability, use the MethodName_StateUnderTest naming convention. This skill generates test code following this pattern, grouping tests by class and behavior to ensure maintainable and easily scannable test suites.