-
Notifications
You must be signed in to change notification settings - Fork 199
Update csharp-mstest.prompt.md #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update to align with our current recommendations on how to use MSTest.
There was a problem hiding this 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 PR updates the MSTest guidance in csharp-mstest.prompt.md
to align with current best practices.
- Switched from referencing multiple MSTest packages to a single
MSTest
package - Updated data-driven attribute recommendation from
[DataTestMethod]
to[TestMethod]
- Changed the exception assertion from
Assert.ThrowsException<T>
toAssert.Throws<T>
@@ -36,7 +36,7 @@ Your goal is to help me write effective unit tests with MSTest, covering both st | |||
|
|||
## Data-Driven Tests | |||
|
|||
- Use `[DataTestMethod]` combined with data source attributes | |||
- Use `[TestMethod]` combined with data source attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub isn't allowing me to add a comment on the specific line. But on line 43, there is a mention of CsvDataSource
. I'm not aware of such attribute 😄
We only have DataSourceAttribute
which can be set to use Csv. A sample for using Csv is https://github.com/microsoft/testfx/blob/b1edce21fa74ac0444f92355d230a498196a3382/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DataSourceTests.cs, which is a bit involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://grep.app/search?q=%5BCsvDataSource%5D yeah that one seemed curious to me as well, does not seem to exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth removing it then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah as they are outside the diff commenting isn't supported.
Let's get that fixed and then I can merge these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -11,7 +11,7 @@ Your goal is to help me write effective unit tests with MSTest, covering both st | |||
## Project Setup | |||
|
|||
- Use a separate test project with naming convention `[ProjectName].Tests` | |||
- Reference Microsoft.NET.Test.Sdk, MSTest.TestAdapter, and MSTest.TestFramework packages | |||
- Reference MSTest package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider noting MSTest.Sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can suggest it, but not all repos use MTP and mstest.sdk is still not nicely supported in VS because of the nuget tooling, so I would not default to it.
@@ -36,7 +36,7 @@ Your goal is to help me write effective unit tests with MSTest, covering both st | |||
|
|||
## Data-Driven Tests | |||
|
|||
- Use `[DataTestMethod]` combined with data source attributes | |||
- Use `[TestMethod]` combined with data source attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah as they are outside the diff commenting isn't supported.
Let's get that fixed and then I can merge these changes.
Update to align with our current recommendations on how to use MSTest.
Pull Request Checklist
node update-readme.js
and verified thatREADME.md
is up to date.Description
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.