create-tests

Generate xUnit unit tests with Moq for C# service and controller classes.

Updated Nov 13, 2025
One-click install
npx skills add https://github.com/changjian-wang/dawning --skill create-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-tests
Source: https://github.com/changjian-wang/dawning/tree/main/.github/skills/create-tests
Command: npx skills add https://github.com/changjian-wang/dawning --skill create-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the creation of unit tests for your C# code, ensuring better code quality and maintainability by following established testing patterns.

Core Features & Use Cases

  • xUnit Test Generation: Creates test classes using the xUnit framework.
  • Moq Integration: Implements mocking for dependencies using Moq.
  • UnitOfWork Pattern: Demonstrates correct mocking of the UnitOfWork pattern for service tests.
  • Controller Testing: Provides templates for testing API controllers.
  • Use Case: When developing a new feature, use this Skill to quickly scaffold comprehensive unit tests for your services and controllers, adhering to best practices.

Quick Start

Use the create-tests skill to generate unit tests for the UserService class.

Frequently Asked Questions about create-tests

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

FAQPage Schema
How do I generate xUnit tests with Moq for C# controllers and services?

Generate xUnit tests with Moq for C# controllers and services by scaffolding test classes that mock the UnitOfWork pattern and repository dependencies. This provides templates for standard naming conventions, test structure, and parameterization.

What is the best way to mock the UnitOfWork pattern in C# service tests?

Mocking the UnitOfWork pattern in C# service tests involves using Moq to simulate repository dependencies within the UnitOfWork. This isolates the service logic during xUnit test generation without hitting actual database layers.

Can I scaffold parameterized xUnit tests for C# classes automatically?

Yes, you can scaffold parameterized xUnit tests for C# classes automatically. The generated test classes include guidance on test structure and parameterization, allowing you to cover multiple data scenarios efficiently.

Does this xUnit test generation include exception testing patterns?

Yes, xUnit test generation includes exception testing patterns. It provides structured guidance for testing exceptions, ensuring your C# service and controller tests validate error handling and edge cases properly.

What C# testing frameworks and dependencies are required for this scaffolding?

This test scaffolding requires the xUnit framework and the Moq library for C#. It targets service and controller testing patterns, simulating dependencies like repositories and the UnitOfWork pattern.