Comparison constraints are able to test whether one value is greater or less than another. Comparison constraints work on numeric values, as well as other objects that implement IComparable.
| Syntax Helper | Constructor | Operation |
|---|---|---|
| Is.GreaterThan( IComparable ) | GreaterThanConstraint( IComparable ) | tests that one value is greater than another |
| Is.GreaterThanOrEqualTo( IComparable ) | GreaterThanOrEqualConstraint( IComparable ) | tests that one value is greater than or equal to another |
| Is.AtLeast( IComparable ) | GreaterThanOrEqualConstraint( IComparable ) | tests that one value is greater than or equal to another |
| Is.LessThan( IComparable ) | LessThanConstraint( IComparable ) | tests that one value is less than another |
| Is.LessThanOrEqualTo( IComparable ) | LessThanOrEqualConstraint( IComparable ) | tests that one value is less than or equal to another |
| Is.AtMost( IComparable ) | LessThanOrEqualConstraint( IComparable ) | tests that one value is less than or equal to another |
Assert.That(7, Is.GreaterThan(3)); Assert.That(7, Is.GreaterThanOrEqualTo(3)); Assert.That(7, Is.AtLeast(3)); Assert.That(7, Is.GreaterThanOrEqualTo(7)); Assert.That(7, Is.AtLeast(7)); Assert.That(3, Is.LessThan(7)); Assert.That(3, Is.LessThanOrEqualTo(7)); Assert.That(3, Is.AtMost(7)); Assert.That(3, Is.LessThanOrEqualTo(3)); Assert.That(3, Is.AtMost(3)); // Using Inheritance Expect( 7, GreaterThan(3)); Expect( 3, AtMost(7));