dotnet-tdd

Guide .NET developers through a RED-GREEN-REFACTOR test-first workflow for ASP.NET Core and EF Core.

Updated Jan 15, 2026
One-click install
npx skills add https://github.com/fiatkongen/saurun-marketplace --skill dotnet-tdd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-tdd
Source: https://github.com/fiatkongen/saurun-marketplace/tree/main/plugins/saurun/skills/dotnet-tdd
Command: npx skills add https://github.com/fiatkongen/saurun-marketplace --skill dotnet-tdd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps .NET teams adopt true Test-Driven Development by providing a concise framework for writing tests before implementation, guiding teams through disciplined test-first cycles for ASP.NET Core and EF Core features.

Core Features & Use Cases

  • Red-Green-Refactor workflow: enforces failing tests, minimal production code, and clean refactors for robust .NET codebases.
  • Testing best practices: codifies rules like avoiding getter/setter tests, testing public behavior, and prioritizing integration tests for real outcomes.
  • ASP.NET Core + EF Core guidance: applies TDD patterns to API services, data access layers, and domain logic using xUnit and NSubstitute.

Quick Start

Run the standard TDD cycle in your project: write a failing test for a new feature, implement just enough code to pass the test, and then refactor while keeping all tests green.

Frequently Asked Questions about dotnet-tdd

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

FAQPage Schema
How do I practice TDD in ASP.NET Core with EF Core?

TDD in ASP.NET Core with EF Core involves writing failing xUnit tests for API services and domain logic first, then implementing minimal production code to pass. This skill guides you through strict mock boundaries using NSubstitute to ensure real domain behavior is tested.

What's the best way to structure xUnit tests for .NET domain logic?

The best way to structure xUnit tests for .NET domain logic is to emphasize testing public behavior rather than internal getters and setters. You should use strict mock boundaries with NSubstitute and prioritize integration tests to verify actual database state and API responses.

Does true Test-Driven Development require integration tests for EF Core?

True Test-Driven Development for EF Core requires integration tests to verify real database state and API responses. While unit tests with NSubstitute check domain logic, integration tests ensure your data access layers and API endpoints behave correctly under real conditions.

Why should I avoid getter and setter tests in .NET TDD?

You should avoid getter and setter tests in .NET TDD because they verify trivial language mechanics rather than meaningful public behavior. True TDD focuses on testing domain logic and real outcomes through the Red-Green-Refactor cycle, ensuring robust codebases.

Can I use NSubstitute with xUnit for mocking in ASP.NET Core?

Yes, you can use NSubstitute with xUnit for mocking in ASP.NET Core. This TDD workflow uses NSubstitute to establish strict mock boundaries, ensuring that your xUnit tests validate real domain behavior rather than just testing the mocks themselves.

When do I refactor code in the TDD Red-Green-Refactor cycle?

You refactor code in the TDD Refactor phase after writing a failing test and implementing just enough production code to make it pass. During this phase, you clean up the codebase while keeping all xUnit tests green, ensuring functionality remains intact.