dotnet-testing

Automate writing and validating .NET unit tests with xUnit, Moq, and FluentAssertions.

9|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill dotnet-testing-aratkruglik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-testing
Source: https://github.com/AratKruglik/antigravity-sdlc/tree/main/plugins/csharp-foundation/skills/dotnet-testing
Command: npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill dotnet-testing-aratkruglik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing robust .NET tests can be time-consuming and error-prone; this skill provides established patterns for unit testing with xUnit, mocking with Moq or NSubstitute, fluent assertions, and code coverage with coverlet.

Core Features & Use Cases

  • Test structure: use xUnit with [Fact] and [Theory] patterns.
  • Mocking discipline: integrate Moq or NSubstitute to isolate dependencies.
  • Assertions & coverage: leverage FluentAssertions for expressive tests and coverlet for line-coverage thresholds.
  • Scope: applicable to libraries, services, and API clients across .NET projects.

Quick Start

Create a .NET test project and start writing tests using xUnit, Moq or NSubstitute, and FluentAssertions.

Frequently Asked Questions about dotnet-testing

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

FAQPage Schema
How do I write robust .NET unit tests with xUnit and FluentAssertions?

To write robust .NET unit tests with xUnit and FluentAssertions, you apply [Fact] and [Theory] patterns for test structure and use expressive assertions. This establishes maintainable test code across libraries, services, and API clients.

What's the best way to isolate dependencies in .NET tests using Moq or NSubstitute?

The best way to isolate dependencies in .NET tests using Moq or NSubstitute is to integrate either mocking framework directly into your xUnit test project. This enforces mocking discipline by isolating system dependencies for reliable validation.

How does coverlet measure code coverage in .NET testing?

Coverlet measures code coverage in .NET testing by calculating line coverage within your test pipelines. It enforces coverage thresholds to ensure your xUnit test suite maintains high quality across all tested components.

Can I use both Moq and NSubstitute in the same .NET test project?

While you can technically use both Moq and NSubstitute in a .NET test project, standard practice involves choosing one mocking framework to maintain consistency. Both integrate seamlessly with xUnit and FluentAssertions for dependency isolation.

When do I need FluentAssertions for my xUnit tests?

You need FluentAssertions for your xUnit tests when you require more expressive and readable assertion syntax. It enhances test maintainability by providing fluent validation chains instead of standard assertion attributes.

Does this .NET testing approach work for API clients and services?

Yes, this .NET testing approach works for API clients and services. The established patterns for xUnit, FluentAssertions, and coverlet are applicable across libraries, services, and API clients to improve overall test quality.