NUnit的TestCaseAttribute等价于VS单元测试框架 [英] NUnit's TestCaseAttribute equivalent in VS Unit Test Framework

查看:172
本文介绍了NUnit的TestCaseAttribute等价于VS单元测试框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个NUnit的的TestCaseAttribute相当于在Visual Studio 2008单元测试框架



您知道,像这样:



  [TestCase的(1,1,1)] 
[测试用例(2,2,2)]
[测试用例(3,3,3)
公共无效的Test1(INT A,INT b,INT C)
{
//做的东西取决于TestCase的
}


解决方案

MSTest的遗憾的是不支持这样的参数化测试。你得到的最接近的是与数据源属性,它允许你指定的外部数据测试方法源。


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 
}

解决方案

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.

这篇关于NUnit的TestCaseAttribute等价于VS单元测试框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆