代码检查:NUnit。 测试用例 Result 属性已过时。
从 NUnit 2.6.2 开始, TestCase 属性的命名参数 结果 已被弃用,建议使用 ExpectedResult 参数,它具有相同的功能。
从 NUnit 3.0 开始, 结果 不再受支持,任何使用此参数的测试都无法在 NUnit 3.0 中编译。
此检查会检测 结果 参数的使用,并建议将其替换为 ExpectedResult。
// 'Result' is obsolete and should be replaced with 'ExpectedResult'
[TestCase(12, 3, Result = 4)]
public int DivideTest(int n, int d)
{
return (n / d);
}
最后修改日期: 2025年 9月 26日