JetBrains Rider 2024.3 Help

Code inspection: NUnit. Incorrect range bounds. 'to' must be greater than or equal to 'from'.

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

However, to use a decreasing range of values, you must explicitly specify a negative step in the third argument. Another way to fix the problem is to swap the first and the second arguments so that the range becomes increasing.

[Test] public void MyTest( // Incorrect range bounds. 'to' must be greater than or equal to 'from', // or there must be a negative step [Range(20, 10)] int x) { // do something }
Last modified: 11 February 2024