ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

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

Last modified: 11 February 2024

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.