test-writer

Generate xUnit and Moq unit tests for .NET 8 C# 12 components.

Updated Dec 20, 2023
One-click install
npx skills add https://github.com/Thiago-Cruz-eng/Hibrygame --skill test-writer-thiago-cruz-eng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-writer
Source: https://github.com/Thiago-Cruz-eng/Hibrygame/tree/main/.claude/skills/test-writer
Command: npx skills add https://github.com/Thiago-Cruz-eng/Hibrygame --skill test-writer-thiago-cruz-eng

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It eliminates the time-consuming uncertainty of writing correct unit tests by guiding you through defining scope, mapping scenarios, and generating xUnit + Moq test code for .NET services, queries, and domain entities.

Core Features & Use Cases

  • Scenario-driven unit testing: Covers happy path, null/invalid inputs, not-found cases, expected exceptions, and edge conditions.
  • Deterministic xUnit + Moq patterns: Enforces AAA structure, consistent naming, and safe mocking rules (including verifying method calls).
  • Target-aware file guidance: Recommends where Service, Query, and Domain tests should live in the repository.
  • Use Case: Generate unit tests for a CustomerService and its dependent repositories while ensuring all external integrations are mocked and no real calls are made.

Quick Start

Ask the test-writer skill to create unit tests for your target file by providing the service or query path, for example: “Write tests for CustomerService.cs.”

Frequently Asked Questions about test-writer

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

FAQPage Schema
How do I generate unit tests for .NET 8 services and domain entities?

To generate unit tests for .NET 8, provide a target service, query, or entity file path. The skill reads the artifact, maps required test scenarios, and outputs deterministic xUnit and Moq test code with Arrange/Act/Assert structure.

What is the best way to mock external dependencies in C# 12 unit tests?

The best way to mock external dependencies in C# 12 unit tests is using Moq. This skill safely mocks external integrations for repositories and services, verifying method calls while ensuring no real external calls are made during test execution.

How do I structure xUnit test scenarios for a target query or repository?

Structuring xUnit test scenarios involves enumerating happy path, null/invalid inputs, not-found cases, and expected exceptions. The skill maps these scenarios and produces deterministic test code with clear Arrange/Act/Assert separation and consistent naming conventions.

Does this unit testing approach work with CancellationToken for .NET components?

Yes, this unit testing approach fully supports CancellationToken for .NET components. The generated xUnit tests explicitly use CancellationToken.None to ensure deterministic test execution and fulfill required .NET 8 testing constraints.

Where should I place generated xUnit test files for domain entities and services?

Generated xUnit test files should be placed in target-aware repository locations. The skill recommends specific file locations for Service, Query, and Domain tests to maintain consistent project structure and naming conventions across your .NET 8 solution.