NUnit's TestCaseAttribute equivalent in VS Unit Test Framework

穿精又带淫゛_ 提交于 2020-01-03 19:15:44

问题


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 
}

回答1:


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.



来源:https://stackoverflow.com/questions/2411321/nunits-testcaseattribute-equivalent-in-vs-unit-test-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!