Range Constraint
RangeConstraint
tests that a value is in an (inclusive) range.
Constructor
RangeConstraint(IComparable from, IComparable to)
Syntax
Is.InRange(IComparable from, IComparable to)
Modifiers
...Using(IComparer comparer)
...Using<T>(IComparer<T> comparer)
...Using<T>(Comparison<T> comparer)
Examples of Use
[Test]
public void RangeConstraint_Examples()
{
int[] intArray = [1, 2, 3, 4, 5, 6, 7, 8, 9];
Assert.That(5, Is.InRange(1, 10));
Assert.That(42, Is.Not.InRange(1, 10));
Assert.That(intArray, Has.All.InRange(1, 10));
}