ReSharper 2018.3 Help

Code Inspection: Incompatible expected result type or incorrect value

This inspection notifies you about mismatch of the type of a value that you pass to your test via the ExpectedResult argument and the return type of the test method. For example:

[TestCase(ExpectedResult = "100")] // incorrect: type mismatch [TestCase(ExpectedResult = 100)] // correct public int Test1() { return 100; }

Note that NUnit will try to convert the value supplied via ExpectedResult before using it in the test, and ReSharper takes this conversion into consideration before issuing the warning. Note also, that NUnit 2.x and NUnit 3 have different value conversion logic.

Last modified: 25 April 2019

See Also