代码检查:NUnit。 测试用例 Result 属性重复了 ExpectedResult。
从 NUnit 2.6.2 开始, TestCase 属性的命名参数 结果 (您可以使用它来指定测试方法返回的预期结果)已被弃用,建议改用 期望结果 参数,其功能相同。
从 NUnit 3.0 开始, 结果 不再受支持,任何使用此参数的测试都无法与 NUnit 3.0 一起编译。
如果在 测试用例 的属性中意外同时使用了 结果 和 期望结果 ,则 结果 是多余的,应将其移除。
// '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年 9月 27日