代码检查:NUnit。 测试用例 Result 属性重复了 ExpectedResult。
从 NUnit 2.6.2 开始, TestCase 属性的命名参数 Result 已被弃用,建议使用 ExpectedResult 参数,它具有相同的功能。
从 NUnit 3.0 开始, Result 不再受支持,任何使用此参数的测试都无法与 NUnit 3.0 一起编译。
如果在 TestCase 的属性中意外同时使用了 Result 和 ExpectedResult ,则 Result 是多余的,应将其移除。
// 'Result' is redundant and should be removed
[TestCase(12, 3, Result = 4, ExpectedResult = 4)]
public int DivideTest(int n, int d)
{
return (n / d);
}
最后修改日期: 2025年 12月 8日