Improve best practices for MSTest#658
Merged
aaronpowell merged 3 commits intogithub:mainfrom Feb 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 anoutparameter. 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
modelfield in the front matter. According to the coding guidelines, you should strongly encourage the use ofmodelto specify the model that the prompt is optimized for. Consider adding a line likemodel: 'gpt-4.1'ormodel: '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'
---
aaronpowell
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.Description
Improves best practices for MSTest to take into consideration new features, analyzers recommendations and advanced guidelines.
Type of Contribution
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.