JetBrains Rider 2024.3 Help

Code inspection: NUnit. Mismatch of the range step sign.

The NUnit's Range Attribute allows specifying decreasing ranges of values, that is when from is greater that to.

However, if you explicitly specify the step of the range in the third argument, it must be positive for increasing ranges and negative for decreasing ranges. If the step doesn't match the range, the test will not be executed.

[Test] public void MyTest( // The sign of the 'step' parameter // must be negative to match the range values [Range(20, 10, 2)] int x) { // do something }
Last modified: 11 February 2024