ReSharper 2023.2 Help

Code Inspection: NUnit. The maximum range value is not reachable with the step value

If the maximum value specified in the to argument 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 MyTest( // In NUnit 2.x the test will be executed with '255' but not with '256' [Range(0, 256, 5)] byte x) { // do something }
Last modified: 23 April 2021