JetBrains Rider 2024.1 Help

Code Inspection: NUnit. Test case Result property duplicates ExpectedResult

Category

NUnit

ID

NUnit.TestCaseResultPropertyDuplicatesExpectedResult

EditorConfig

resharper_n_unit_test_case_result_property_duplicates_expected_result_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

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: 17 April 2024