csharp-testing

Automate .NET application testing with xUnit, FluentAssertions, NSubstitute, Moq, Testcontainers, and WebApplicationFactory.

2|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/klu-dev/porting-ecc-to-vscode --skill csharp-testing-klu-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-testing
Source: https://github.com/klu-dev/porting-ecc-to-vscode/tree/main/.github/skills/csharp-testing
Command: npx skills add https://github.com/klu-dev/porting-ecc-to-vscode --skill csharp-testing-klu-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires xunit, fluentassertions, nsubstitute, moq, testcontainers, webapplicationfactory, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the testing process for .NET applications, enabling efficient creation, review, and maintenance of high-quality tests.

Core Features & Use Cases

  • Unit Testing: Facilitates writing and executing comprehensive unit tests using xUnit and FluentAssertions.
  • Mocking: Provides support for mocking dependencies with NSubstitute or Moq.
  • Integration Testing: Enables testing of .NET applications in a real-world environment using Testcontainers and WebApplicationFactory.
  • Test Organization: Offers guidance on structuring tests for readability and maintainability.
  • Use Case: Imagine you have a complex .NET application with multiple services. Use this Skill to ensure that each service is thoroughly tested, from unit tests to integration tests.

Quick Start

Use the csharp-testing skill to generate a basic unit test for your OrderService class.

Frequently Asked Questions about csharp-testing

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

FAQPage Schema
How do I write unit tests for .NET applications using xUnit and FluentAssertions?

Unit testing .NET applications with xUnit and FluentAssertions involves creating test classes to verify individual service logic. This Skill automates generating and organizing these tests to ensure comprehensive coverage and maintainable code.

What's the best way to mock dependencies in .NET integration tests?

The best way to mock dependencies in .NET integration tests is using NSubstitute or Moq. These frameworks isolate external services, allowing you to test specific components within a real-world environment without relying on live dependencies.

Does Testcontainers work with WebApplicationFactory for .NET testing?

Testcontainers works with WebApplicationFactory to enable .NET integration testing. You can spin up real dependencies like databases in containers while using WebApplicationFactory to route HTTP requests through the ASP.NET Core pipeline.

Can I use this .NET testing approach with .NET Core or do I need .NET 5/6?

You can use this .NET testing approach with .NET Core, .NET 5, or .NET 6. Execution requires at least .NET Core or .NET 5/6 to run the automated unit and integration tests using the supported frameworks.

How do I structure complex .NET tests for multiple services?

To structure complex .NET tests for multiple services, organize tests by separating unit tests from integration tests. This Skill provides guidance on structuring tests for readability and maintainability, ensuring each service layer is thoroughly validated.