Skip to content

Commit 5ef3a71

Browse files
authored
Removed the mention of DataTestMethod attribute (#26233)
* Removing mention of DataTestMethod attribute * Update PrimeService_IsPrimeShould.cs
1 parent ea2dc9c commit 5ef3a71

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService_IsPrimeShould.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void IsPrime_InputIs1_ReturnFalse()
2222
}
2323

2424
#region Sample_TestCode
25-
[DataTestMethod]
25+
[TestMethod]
2626
[DataRow(-1)]
2727
[DataRow(0)]
2828
[DataRow(1)]

docs/core/testing/unit-testing-with-mstest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ In the *unit-testing-using-mstest* directory, run `dotnet test` again. The `dotn
153153

154154
## Add more features
155155

156-
Now that you've made one test pass, it's time to write more. There are a few other simple cases for prime numbers: 0, -1. You could add new tests with the [TestMethod attribute](xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute), but that quickly becomes tedious. There are other MSTest attributes that enable you to write a suite of similar tests. A [DataTestMethod attribute](xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataTestMethodAttribute) represents a suite of tests that execute the same code but have different input arguments. You can use the [DataRow attribute](xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute) to specify values for those inputs.
156+
Now that you've made one test pass, it's time to write more. There are a few other simple cases for prime numbers: 0, -1. You could add new tests with the [TestMethod attribute](xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute), but that quickly becomes tedious. There are other MSTest attributes that enable you to write a suite of similar tests. A test method can execute the same code but have different input arguments. You can use the [DataRow attribute](xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute) to specify values for those inputs.
157157

158158
Instead of creating new tests, apply these two attributes to create a single data driven test. The data driven test is a method that tests several values less than two, which is the lowest prime number. Add a new test method in *PrimeService_IsPrimeShould.cs*:
159159

0 commit comments

Comments
 (0)