ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: NUnit. Redundant argument instead of ExpectedResult.

Last modified: 08 April 2024

The arguments of NUnit's TestCase attribute can be used for providing both values for test parameters and the expected result of the test. The expected result must be always specified by using the named parameter ExpectedResult.

If the test method returns a value and ReSharper finds an argument with a data value instead of ExpectedResult, it issues a warning and provides a quick-fix that converts the value to the expected result.