csharp-mstest
Get best practices for MSTest 3.x/4.x unit testing, including modern assertion APIs and data-driven tests
Target: Software development & testing. Automatically collected · unverified.
Excerpt from the author’s documentation
Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.
Read the original English text
Topics in the source
- MSTest Best Practices (MSTest 3.x/4.x)
- Project Setup
- Test Class Structure
- Test Lifecycle
- Execution Order
- Modern Assertion APIs
- Assert Class - Core Assertions
- Exception Testing (Prefer over [ExpectedException])
Your goal is to help me write effective unit tests with modern MSTest, using current APIs and best practices. Use a separate test project with naming convention [ProjectName].Tests Reference MSTest 3.x+ NuGet packages (includes analyzers) Consider using MSTest.Sdk for simplified project setup Run tests with dotnet test Use [TestClass] attribute for test classes Seal test classes by default for performance and design clarity Use [TestMethod] for test methods (prefer over [DataTestMethod]) Follow Arrange-Act-Assert (AAA) pattern Name tests using pattern MethodNameScenarioExpectedBehavior Prefer constructors over [TestInitialize] - enables readonly fields and follows standard C# patterns Use [TestCleanup] for cleanup that must run even if test fails Combine constructor with async [TestInitialize] when async setup is needed 1. Assembly Initialization - [AssemblyInitialize] (once per test assembly) 2. Class Initialization - [ClassInitialize] (once per test class) 3. Test Initialization (for every test method): 1. Constructor 2. Set TestContext property 3. [TestInitialize] 4. Test Execution - test method runs 5. Test Cleanup (for every test method): 1. [TestCleanup] 2. DisposeAsync (if i
This is an excerpt. Refer to the complete source and its current requirements.
- Source repository
- OKHP3/skillz
- Source file
- community/csharp-mstest/SKILL.md
- Fixed revision
- 7b187777d42ab7bc7bab1e5f2c940cd3139ecebf
Requirements
- Only the author’s Skill metadata is included. Read the full instructions to check dependencies, licensing and conditions of use.
A small first task
先阅读原作者说明,再决定是否在自己的 AI 工具中使用。
Instructions for your AI tool
- Claude Desktop: resource-specific guide not available yet
- Claude Code: resource-specific guide not available yet
- Cursor: resource-specific guide not available yet
- Codex: resource-specific guide not available yet
Author documentation is not live verification by this site. Without evidence, we do not mark a resource as compatible, safe or free.
Sources and evidence
This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.
Author: OKHP3/skillz · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-10T10:00:54.127Z.
Categories are inferred from names, descriptions and paths. They do not establish compatibility.
License and attribution
MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.
Original license ↗Synchronization, copying and user-reported success do not mark a resource as runtime-tested.
Limitations and notes
- Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.