csharp-mstest
Get best practices for MSTest 3.x/4.x unit testing, including modern assertion APIs and data-driven tests
npx skills add github/awesome-copilot --skill csharp-mstest --agent copilot
Same command for any agent — swap --agent for claude-code, codex, cursor.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# MSTest Best Practices (MSTest 3.x/4.x) Your goal is to help me write effective unit tests with modern MSTest, using current APIs and best practices. ## Project Setup - 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` ## Test Class Structure - 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 `MethodName_Scenario_ExpectedBehavior` ```csharp [TestClass] public sealed class CalculatorTests { [TestMethod] public void Add_TwoPositiveNumbers_ReturnsSum() { // Arrange var calculator = new Calculator(); // Act var result = calculator.Add(2, 3); // Assert Assert.AreEqual(5, result); } } ``` ## Test Lifecycle - **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 `[T
- Project Setup
- Test Class Structure
- Test Lifecycle
- Execution Order
- Modern Assertion APIs
- Assert Class - Core Assertions
- Exception Testing (Prefer over [ExpectedException])
- Collection Assertions (Assert class)
- String Assertions (Assert class)
- Comparison Assertions
- Type Assertions
- Assert.That (MSTest 4.0+)
- StringAssert Class
- CollectionAssert Class
What does the csharp-mstest skill do?
Get best practices for MSTest 3.x/4.x unit testing, including modern assertion APIs and data-driven tests
How do I install it?
Run `npx skills add github/awesome-copilot --skill csharp-mstest --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From github/awesome-copilot, a repository with 37,432 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.