JetBrains Rider 2024.1 Help

Code Inspection: NUnit. Specified values are not compatible with the test parameter type

Category

NUnit

ID

NUnit.ParameterTypeIsNotCompatibleWithAttribute

EditorConfig

resharper_n_unit_parameter_type_is_not_compatible_with_attribute_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

This inspection notifies you about mismatch of a value in the test data of a parameterized test and the type of the corresponding parameter in the test method.

In the example below, the first two arguments from and to of the Range attribute are compatible with the parameter type int, but the value of the third argument step, makes the resulting test values incompatible with int:

[Test] public void MyTest( // The type 'double' provided in [Range] // is not compatible with the test parameter type 'int' [Range(1, 10, 0.2)] int x) { // do something }
Last modified: 15 April 2024