Skip to content

Commit

Permalink
Add documentation for inequality constraints with tolerance (#907)
Browse files Browse the repository at this point in the history
* Add documentation to inequality constraints with tolerance

* Update docs/articles/nunit/writing-tests/constraints/GreaterThanOrEqualConstraint.md

---------

Co-authored-by: Sean Killeen <[email protected]>
  • Loading branch information
RenderMichael and SeanKilleen authored Feb 24, 2024
1 parent c94c743 commit e37afe2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Is.Positive // Equivalent to Is.GreaterThan(0)
...Using(IComparer comparer)
...Using<T>(IComparer<T> comparer)
...Using<T>(Comparison<T> comparer)
...Within(object tolerance)
```

## Examples of Use
Expand All @@ -29,4 +30,5 @@ Is.Positive // Equivalent to Is.GreaterThan(0)
Assert.That(7, Is.GreaterThan(3));
Assert.That(myOwnObject, Is.GreaterThan(theExpected).Using(myComparer));
Assert.That(42, Is.Positive);
Assert.That(myDateTime, Is.GreaterThan(expectedDateTime).Within(TimeSpan.FromSeconds(1)))
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Is.AtLeast(object expected)
...Using(IComparer comparer)
...Using<T>(IComparer<T> comparer)
...Using<T>(Comparison<T> comparer)
...Within(object tolerance)
```

## Examples of Use
Expand All @@ -31,4 +32,5 @@ Assert.That(7, Is.AtLeast(3));
Assert.That(7, Is.GreaterThanOrEqualTo(7));
Assert.That(7, Is.AtLeast(7));
Assert.That(myOwnObject, Is.GreaterThanOrEqualTo(theExpected).Using(myComparer));
Assert.That(myDateTime, Is.GreaterThanOrEqualTo(expectedDateTime).Within(TimeSpan.FromSeconds(1)))
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Is.Negative // Equivalent to Is.LessThan(0)
...Using(IComparer comparer)
...Using<T>(IComparer<T> comparer)
...Using<T>(Comparison<T> comparer)
...Within(object tolerance)
```

## Examples of Use
Expand All @@ -29,4 +30,5 @@ Is.Negative // Equivalent to Is.LessThan(0)
Assert.That(3, Is.LessThan(7));
Assert.That(myOwnObject, Is.LessThan(theExpected).Using(myComparer));
Assert.That(-5, Is.Negative);
Assert.That(myDateTime, Is.LessThan(expectedDateTime).Within(TimeSpan.FromSeconds(1)))
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Is.AtMost(object expected)
...Using(IComparer comparer)
...Using<T>(IComparer<T> comparer)
...Using<T>(Comparison<T> comparer)
...Within(object tolerance)
```

## Examples of Use
Expand All @@ -31,4 +32,5 @@ Assert.That(3, Is.AtMost(7));
Assert.That(3, Is.LessThanOrEqualTo(3));
Assert.That(3, Is.AtMost(3));
Assert.That(myOwnObject, Is.LessThanOrEqualTo(theExpected).Using(myComparer));
Assert.That(myDateTime, Is.LessThanOrEqualTo(expectedDateTime).Within(TimeSpan.FromSeconds(1)))
```

0 comments on commit e37afe2

Please sign in to comment.