代码检查:NUnit。 指定的值与测试参数类型不兼容。
此检查会通知您 参数化测试的测试数据中的值与测试方法中相应参数的类型不匹配。
在下面的示例中, Range 属性的前两个参数 从 和 结束值 与参数类型 int 兼容,但第三个参数 步长 的值使得生成的测试值与 int 不兼容:
[Test]
public void MyTest(
// The type 'double' provided in [Range]
// is not compatible with the test parameter type 'int'
[Range(1, 10, 0.2)] int x)
{
// do something
}
最后修改日期: 2025年 9月 26日