Code inspection: NUnit. Test case Result property duplicates ExpectedResult.
Starting from NUnit 2.6.2, the named parameter Result
of the TestCase Attribute, which you can use to specify the expected result to be returned from the test method, becomes deprecated in favor of the ExpectedResult
parameter, which serves the same purpose.
Starting from NUnit 3.0, Result
is not supported anymore and any tests that use this parameter will not compile with NUnit 3.0.
If both Result
and ExpectedResult
are accidentally used in the attributes of TestCase
, the Result
is redundant and should be removed.
// 'Result' is redundant and should be removed
[TestCase(12, 3, Result = 4, ExpectedResult = 4)]
public int DivideTest(int n, int d)
{
return (n / d);
}
Last modified: 11 February 2024