ReSharper 2024.1 Help

Code Inspection: NUnit. Values in range do not fit the type of the test parameter

Category

NUnit

ID

NUnit.RangeAttributeBoundsAreOutOfRange

EditorConfig

resharper_n_unit_range_attribute_bounds_are_out_of_range_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

If the minimum or the maximum value specified in the from and to arguments of the NUnit's Range Attribute is beyond the limit of the test parameter type, the test will not work properly. In NUnit 2.x tests with out-of-the-bounds values will not be executed. In NUnit 3.x the test will fail with the Out of range error.

[Test] public void Test1([Range(-1000, -999, 1)] byte x) { // do something }
Last modified: 15 April 2024