csharp-mstest

Write modern MSTest 3.x and 4.x unit tests for .NET code.

Updated May 16, 2026
One-click install
npx skills add https://github.com/p-o-ke-nae/pokemondamagecalculatorforstory --skill csharp-mstest-p-o-ke-nae
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-mstest
Source: https://github.com/p-o-ke-nae/pokemondamagecalculatorforstory/tree/main/.github/skills/csharp-mstest
Command: npx skills add https://github.com/p-o-ke-nae/pokemondamagecalculatorforstory --skill csharp-mstest-p-o-ke-nae

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write and improve MSTest unit tests that are clearer, more maintainable, and aligned with modern MSTest 3.x and 4.x practices, reducing flaky, outdated, or hard-to-read test code.

Core Features & Use Cases

  • Modern assertion guidance for equality, exceptions, collections, strings, comparison, and type checks.
  • Data-driven testing patterns using DataRow and DynamicData with type-safe options and metadata support.
  • Test lifecycle, TestContext, cancellation, retry, parallelization, and traceability recommendations for reliable test suites.
  • Use case: modernize an existing .NET test project, or generate a new test class that follows AAA, sealed test classes, and analyzer-friendly conventions.

Quick Start

Ask for MSTest best-practice help for a .NET test class, and include the method or behavior you want tested.

Frequently Asked Questions about csharp-mstest

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

FAQPage Schema
How do I write modern MSTest unit tests for .NET?

To write modern MSTest unit tests, use sealed test classes, follow the AAA pattern, apply current assertion APIs for equality and exceptions, and ensure your code satisfies analyzer-friendly conventions for maintainable test suites.

What is the best way to structure data-driven tests in MSTest 3.x and 4.x?

The best way to structure data-driven tests in MSTest is using DataRow and DynamicData attributes with type-safe options and metadata support to parameterize inputs and cleanly manage multiple test cases.

How do I use TestContext for lifecycle setup and traceability in MSTest?

TestContext provides runtime environment metadata for MSTest lifecycle setup, enabling traceability requirements, cooperative cancellation handling, and parallel execution controls throughout the test run.

Why are my MSTest unit tests flaky and how can I mitigate them?

Flaky MSTest tests are mitigated by applying cooperative cancellation, parallel execution controls, retry mechanisms, and proper lifecycle setup to ensure reliable and deterministic test suite execution.

Does MSTest work with .NET test automation and cooperative cancellation?

Yes, MSTest 3.x and 4.x projects support test automation with cooperative cancellation, parallel execution controls, and traceability requirements to maintain reliable and deterministic .NET test suites.