mstest-unit-test

Write standardized MSTest unit tests with NSubstitute and Entity Framework Core InMemory.

1|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/a35506322/Lab.Todo --skill mstest-unit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mstest-unit-test
Source: https://github.com/a35506322/Lab.Todo/tree/main/.cursor/skills/mstest-unit-test
Command: npx skills add https://github.com/a35506322/Lab.Todo --skill mstest-unit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the common pain point of inconsistent, low-quality unit tests in .NET MSTest projects, ensuring tests are maintainable, reliable, and follow industry-standard best practices for testing adapters, helpers, pure functions, and repository logic.

Core Features & Use Cases

  • Standardized Test Structure: Provides clear folder and naming conventions for MSTest test projects to improve organization and readability.
  • Integrated Mocking & In-Memory DB Support: Includes guidance for using NSubstitute to mock dependencies and Entity Framework Core InMemory for database-related unit tests.
  • Clear Scope Boundaries: Explicitly directs endpoint handler testing to integration tests instead of unit tests, avoiding redundant or flaky test suites.
  • Use Case: For example, when building a .NET API that integrates with external services, use this Skill to write unit tests for your adapter classes that mock HTTP clients and configuration, ensuring tests run quickly without external dependencies.

Quick Start

Use the mstest-unit-test skill to write a unit test for the YouBikeAdapter's GetYouBikeImmediateAsync method that mocks the HTTP client and validates the returned data count.

Frequently Asked Questions about mstest-unit-test

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

FAQPage Schema
How do I write consistent MSTest unit tests for .NET adapter classes?

To write consistent MSTest unit tests for .NET adapters, you should mock external HTTP clients and configuration dependencies using NSubstitute. This ensures your tests run quickly and reliably without hitting actual external services.

What's the best way to unit test repository logic in .NET without a live database?

The best way to unit test repository logic without a live database is using Entity Framework Core InMemory. This allows you to validate data operations in-memory, keeping tests fast and isolated from external database dependencies.

When should I use NSubstitute for mocking dependencies in MSTest projects?

You should use NSubstitute for mocking dependencies in MSTest projects when testing adapters, helper utilities, and pure functions. It helps isolate the system under test by replacing external dependencies with controlled mock objects.

Should I include endpoint handler testing in my .NET MSTest unit test suites?

You should exclude endpoint handler testing from MSTest unit test suites. API layer endpoint handlers should be directed to integration tests instead to avoid redundant, flaky test suites and maintain clear testing scope boundaries.

How do you structure MSTest test projects for maintainability?

To structure MSTest test projects for maintainability, follow standardized folder and naming conventions. Organizing tests by adapters, helpers, and repository logic improves readability and ensures the test suite remains easy to navigate.