-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| - Create test classes that match the classes being tested (e.g., `CalculatorTests` for `Calculator`) | ||
| - Use .NET SDK test commands: `dotnet test` for running tests | ||
|
|
||
|
|
@@ -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 commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Probably worth removing it then
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
| - Use `[DataRow]` for inline test data | ||
| - Use `[DynamicData]` for programmatically generated test data | ||
| - Use `[TestProperty]` to add metadata to tests | ||
|
|
@@ -50,7 +50,7 @@ Your goal is to help me write effective unit tests with MSTest, covering both st | |
| * Use `Assert.IsTrue`/`Assert.IsFalse` for boolean conditions | ||
| * Use `CollectionAssert` for collection comparisons | ||
| * Use `StringAssert` for string-specific assertions | ||
| * Use `Assert.ThrowsException<T>` to test exceptions | ||
| * Use `Assert.Throws<T>` to test exceptions | ||
| * Ensure assertions are simple in nature and have a message provided for clarity on failure | ||
|
|
||
| ## Mocking and Isolation | ||
|
|
||
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.SdkThere 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.