Values
Describes the possible expectations for single values, from bool and numbers to strings, streams and any object.
| Page | Expectations |
|---|---|
| Boolean | IsTrue, IsFalse, Implies |
| Number | IsEqualTo, IsGreaterThan, IsBetween, IsPositive, IsNaN, Within |
| String | IsEqualTo with wildcards or regex, StartsWith, Contains, HasLength |
| Char | IsEqualTo, categories like IsALetter or IsWhiteSpace |
| Enum | IsEqualTo, HasValue, IsDefined, HasFlag |
| Guid | IsEqualTo, IsEmpty, IsNullOrEmpty |
| Version | IsEqualTo, IsGreaterThan, IsBetween, HasMajor |
| Stream | IsReadable, IsSeekable, HasLength, HasPosition |
| TimeSpan | IsEqualTo, IsGreaterThan, IsBetween, IsPositive, Within |
| DateTime / DateTimeOffset | IsEqualTo, IsAfter, IsBefore, IsBetween, HasYear, Within |
| DateOnly / TimeOnly | IsEqualTo, IsAfter, IsBefore, IsBetween, HasYear |
| Object | IsEqualTo, IsSameAs, Is<T>, IsNull, Satisfies, CompliesWith |
| Equivalency | IsEquivalentTo and its options |
A few rules apply to all of these pages:
- A
nullsubject fails every expectation that inspects it, and its negation as well, as the rule fornullsubjects describes. - The
Has…expectations, such asHasLength()orHasYear(), continue with a comparison likeGreaterThanorBetween, as shown for the length of a string. - The options page lists the options that several expectations share, e.g. a
tolerance with
Withinor the string options.