Modern unit testing with MSTest 3.x/4.x using current APIs and best practices.
Works with
Covers test class structure, lifecycle management, and the AAA (Arrange-Act-Assert) pattern with sealed classes and constructor-based initialization
Provides comprehensive assertion APIs including equality, null checks, exception testing (Throws/ThrowsExactly), collections, strings, comparisons, and type assertions
Supports data-driven tests via DataRow and DynamicData with ValueTuple and TestDataRow for t
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versioncsharp-mstestExecute the skills CLI command in your project's root directory to begin installation:
Fetches csharp-mstest from github/awesome-copilot and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate csharp-mstest. Access via /csharp-mstest in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
28.7K
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
28.7K
stars
Your goal is to help me write effective unit tests with modern MSTest, using current APIs and best practices.
[ProjectName].Testsdotnet test[TestClass] attribute for test classes[TestMethod] for test methods (prefer over [DataTestMethod])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);
}
}
[TestInitialize] - enables readonly fields and follows standard C# patterns[TestCleanup] for cleanup that must run even if test fails[TestInitialize] when async setup is needed[TestClass]
public sealed class ServiceTests
{
private readonly MyService _service; // readonly enabled by constructor
public ServiceTests()
{
_service = new MyService();
}
[TestInitialize]
public async Task InitAsync()
{
// Use for async initialization only
await _service.WarmupAsync();
}
[TestCleanup]
public void Cleanup() => _service.Reset();
}
[AssemblyInitialize] (once per test assembly)[ClassInitialize] (once per test class)TestContext property[TestInitialize][TestCleanup]DisposeAsync (if implemented)Dispose (if implemented)[ClassCleanup] (once per test class)[AssemblyCleanup] (once per test assembly)MSTest provides three assertion classes: Assert, StringAssert, and CollectionAssert.
// Equality
Assert.AreEqual(expected, actual);
Assert.AreNotEqual(notExpected, actual);
Assert.AreSame(expectedObject, actualObject); // Reference equality
Assert.AreNotSame(notExpectedObject, actualObject);
// Null checks
Assert.IsNull(value);
Assert.IsNotNull(value);
// Boolean
Assert.IsTrue(condition);
Assert.IsFalse(condition);
// Fail/Inconclusive
Assert.Fail("Test failed due to...");
Assert.Inconclusive("Test cannot be completed because...");
[ExpectedException])// Assert.Throws - matches TException or derived types
var ex = Assert.Throws<ArgumentException>(() => Method(null));
Assert.AreEqual("Value cannot be null.", ex.Message);
// Assert.ThrowsExactly - matches exact type only
var ex = Assert.ThrowsExactly<InvalidOperationException>(() => Method());
// Async versions
var ex = await Assert.ThrowsAsync<HttpRequestException>(async () => await client.GetAsync(url));
var ex = await Assert.ThrowsExactlyAsync<InvalidOperationException>(async () => await Method());
Assert.Contains(expectedItem, collection);
Assert.DoesNotContain(unexpectedItem, collection);
Assert.ContainsSingle(collection); // exactly one element
Assert.HasCount(5, collection);
Assert.IsEmpty(collection);
Assert.IsNotEmpty(collection);
Assert.Contains("expected", actualString);
Assert.StartsWith("prefix", actualString);
Assert.EndsWith("suffix", actualString);
Assert.DoesNotStartWith("prefix", actualString);
Assert.DoesNotEndWith("suffix", actualString);
Assert.MatchesRegex(@"\d{3}-\d{4}", phoneNumber);
Assert.DoesNotMatchRegex(@"\d+", textOnly);
Assert.IsGreaterThan(lowerBound, actual);
Assert.IsGreaterThanOrEqualTo(lowerBound, actual);
Assert.IsLessThan(upperBound, actual);
Assert.IsLessThanOrEqualTo(upperBound, actual);
Assert.IsInRange(actual, low, high);
Assert.IsPositive(number);
Assert.IsNegative(number);
// MSTest 3.x - uses out parameter
Assert.IsInstanceOfType<MyClass>(obj, out var typed)Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
github/awesome-copilot
github/awesome-copilot
github/awesome-copilot
github/awesome-copilot
github/awesome-copilot
github/awesome-copilot
Useful defaults in csharp-mstest — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
csharp-mstest fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
We added csharp-mstest from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Registry listing for csharp-mstest matched our evaluation — installs cleanly and behaves as described in the markdown.
csharp-mstest reduced setup friction for our internal harness; good balance of opinion and flexibility.
Solid pick for teams standardizing on skills: csharp-mstest is focused, and the summary matches what you get after install.
csharp-mstest is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Keeps context tight: csharp-mstest is the kind of skill you can hand to a new teammate without a long onboarding doc.
csharp-mstest reduced setup friction for our internal harness; good balance of opinion and flexibility.
Registry listing for csharp-mstest matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 54