Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUnit's TestCaseAttribute equivalent in VS Unit Test Framework

Is there an NUnit's TestCaseAttribute equivalent in Visual Studio 2008 unit test framework?

You know, something like this:

[TestCase(1, 1, 1)]
[TestCase(2, 2, 2)]
[TestCase(3, 3, 3)]
public void Test1(int a, int b, int c) 
{ 
    // do stuff depending on the TestCase 
}
like image 806
Pedro Avatar asked Apr 17 '26 05:04

Pedro


1 Answers

MSTest unfortunately doesn't support parameterized tests in this way. The closest you get is with the DataSource attribute, which allows you to specify an external data source for the test method.

like image 91
Mark Seemann Avatar answered Apr 19 '26 19:04

Mark Seemann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!