Visual Studio unit testing - a few cases like Nunit

In Nunit, you can reuse the test method for several cases.

[TestCase(12,3,4)] [TestCase(12,2,6)] [TestCase(12,4,3)] public void DivideTest(int n, int d, int q) { Assert.AreEqual( q, n / d ); } 

How to do this in a Visual Studio test environment?

+8
unit-testing visual-studio mstest vs-unit-testing-framework
source share
2 answers

It is impossible out of the box. But for VS 2010, at least you can write MSTEST Extensions to provide almost the same function. Check out the blog . But this is not as good as NUnit TestCase.

+3
source share

Unfortunately, MS Test does not support RowTests. However, a workaround can be hacked using the DataSource attribute. The following is an example.

+2
source share

All Articles