github avatar

Csharp Mstest

The csharp-mstest skill guides C# developers in writing unit tests using MSTest 3.x/4.x by providing best practices for test structure, lifecycle management, and modern assertion APIs. It addresses the need for consistent, maintainable test code by establishing conventions for project setup, naming patterns, initialization strategies, and proper use of MSTest's assertion classes. Developers building .NET applications can use this skill to implement effective unit testing practices aligned with current MSTest standards.

skills.sh installs
8.9K
GitHub stars
41K
last updated
Aug 21, 2026

Install

$ npx -y skills add github/awesome-copilot --skill csharp-mstest --agent claude-code

Installs into .claude/skills of the current project.

Files

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
[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

Sponsors

Details

Repository
github.com/github/awesome-copilot
Categories
Testing & QA, Git & Pull Requests, AI & Agent Building, .NET & C#

More from github/awesome-copilot

All 318
1github avatarcsharp-tunitgithub/awesome-copilotGet best practices for TUnit unit testing, including data-driven tests8.9Kskills.sh installs
2nousresearch avatardogfoodnousresearch/hermes-agentExploratory QA of web apps: find bugs, evidence, reports.6.4Kskills.sh installs
3forcedotcom avatarexperience-lwc-generateforcedotcom/sf-skillsLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patte6.4Kskills.sh installs
4forcedotcom avatardx-org-manageforcedotcom/sf-skillsINVOKE this skill to execute Salesforce org operations: create scratch orgs, create org snapshots, open orgs in browser. This skill EXECUTES operations immediat6.2Kskills.sh installs
5forcedotcom avataragentforce-generateforcedotcom/sf-skillsBuild, modify, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, optimizes, or asks about .agent files or a6Kskills.sh installs
6julianoczkowski avatardesign-reviewjulianoczkowski/designer-skillsRun a structured design critique against the brief and codebase. Checks visual hierarchy, consistency, responsiveness, accessibility, and aesthetic fidelity. Us5.9Kskills.sh installs