可以使用DataRow属性(结合DataTestMethod属性)将数据传递到单元测试。但是,我想知道是否可以将数据传递给单元测试的命名参数。
例如,我现在必须这样做:
[DataTestMethod]
[DataRow(1, null, 3)]
public void MyTest(int? first = null, int? second = null, int? third = null)
{
// Test stuff...
}
然而,我希望能够:
[DataTestMethod]
[DataRow(first: 1, third: 3)]
public void MyTest(int? first = null, int? second = null, int? third = null)
{
// Test stuff...
}
我知道这种语法不“可行”,它更像是伪代码来传达我的问题。
答案 0 :(得分:0)
我想知道是否可以将数据传递给单元测试的命名参数。
不,传递命名参数不是当前版本的MSTest中的可用功能。