ReSharper 2025.2 Help

代码检查:NUnit。 指定的值与测试参数类型不兼容。

此检查会通知您测试数据中 参数化测试的值与测试方法中相应参数的类型不匹配。

在下面的示例中, 范围 属性的前两个参数 起始值结束值 与参数类型 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月 27日