Skip to content

Improve best practices for MSTest#658

Merged
aaronpowell merged 3 commits intogithub:mainfrom
Evangelink:mstest
Feb 3, 2026
Merged

Improve best practices for MSTest#658
aaronpowell merged 3 commits intogithub:mainfrom
Evangelink:mstest

Conversation

@Evangelink
Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • My contribution adds a new instruction, prompt, agent, or skill file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, or skill with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.

Description

Improves best practices for MSTest to take into consideration new features, analyzers recommendations and advanced guidelines.


Type of Contribution

  • New instruction file.
  • New prompt file.
  • New agent file.
  • New collection file.
  • New skill file.
  • Update to existing instruction, prompt, agent, collection or skill.
  • Other (please specify):

Additional Notes


By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

Copilot AI review requested due to automatic review settings February 3, 2026 13:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request significantly updates the MSTest best practices prompt to reflect modern MSTest 3.x/4.x features, APIs, and conventions. The update transforms a basic guide into a comprehensive reference for contemporary MSTest development.

Changes:

  • Updated to focus on MSTest 3.x/4.x with modern APIs including new assertion methods, conditional execution, retry functionality, and work item traceability
  • Added extensive documentation on modern assertion APIs (Assert.Throws, Assert.Contains, comparison assertions, etc.)
  • Expanded test lifecycle guidance with constructor preference over TestInitialize and detailed execution order
  • Enhanced data-driven testing section with ValueTuple and TestDataRow patterns
  • Added comprehensive TestContext coverage including cancellation token support
  • Included advanced features like OSCondition, CICondition, Retry attribute, and work item linking
  • Added "Common Mistakes to Avoid" section with concrete examples
Comments suppressed due to low confidence (2)

prompts/csharp-mstest.prompt.md:448

  • In the "Common Mistakes" section, the example shows var handler = Assert.IsInstanceOfType<MyHandler>(result); as the correct approach. However, this is inconsistent with the earlier Type Assertions section (line 170) which suggests the method has an out parameter. You should ensure the API usage is consistent throughout the document and matches the actual MSTest API.
var handler = Assert.IsInstanceOfType<MyHandler>(result);

prompts/csharp-mstest.prompt.md:5

  • The prompt file is missing the model field in the front matter. According to the coding guidelines, you should strongly encourage the use of model to specify the model that the prompt is optimized for. Consider adding a line like model: 'gpt-4.1' or model: 'Claude Sonnet 4' to indicate which AI model this prompt was designed for.
---
agent: 'agent'
tools: ['changes', 'search/codebase', 'edit/editFiles', 'problems', 'search']
description: 'Get best practices for MSTest 3.x/4.x unit testing, including modern assertion APIs and data-driven tests'
---

Comment thread prompts/csharp-mstest.prompt.md
Comment thread prompts/csharp-mstest.prompt.md
Comment thread prompts/csharp-mstest.prompt.md
@aaronpowell aaronpowell merged commit 9da1f12 into github:main Feb 3, 2026
3 checks passed
@Evangelink Evangelink deleted the mstest branch February 4, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants