gpt4 book ai didi

c# - NUnit 的 TestCaseAttribute 等效于 VS 单元测试框架

转载 作者:行者123 更新时间:2023-11-30 17:23:04 25 4
gpt4 key购买 nike

Visual Studio 2008 单元测试框架中是否有 NUnit 的 TestCaseAttribute 等效项?

你知道,像这样的东西:

[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 不支持这种方式的参数化测试。最接近的是 DataSource属性,允许您为测试方法指定一个外部数据源。

关于c# - NUnit 的 TestCaseAttribute 等效于 VS 单元测试框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2411321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com