Skip to content
Cyrille DUPUYDAUBY edited this page Feb 5, 2018 · 11 revisions

This page lists checks on various types.

Boolean

IsTrue()

Checks that the sut is true. Fails if false.

// this check succeeds
Check.That(true).IsTrue();
// this check fails
Check.That(false).IsTrue);

IsFalse()

Checks that the sut is false. Fails if true.

// this check succeeds
Check.That(false).IsFalse();
// this check fails
Check.That(true).IsFalse);

TimeSpan

IsLessThan(duration, unit)

Checks that the sut represents a duration which is shorter than the expected duration; fails if longer or equal. Uses the TimeUnit to express the unit of time in which the duration is expressed.

// This check succeeds.
Check.That(TimeSpan.FromSeconds(2)).IsLessThan(3, TimeUnit.Seconds);
// This check fails
Check.That(TimeSpan.FromDays(2)).IsLessThan(1, TimeUnit.Hours);
```