Repository navigation
Enumerable types
Cyrille DUPUYDAUBY edited this page Feb 2, 2018
·
21 revisions
The following checks are avaible for all implementation of IEnumerable or IEnumerable.
Checks that the sut contains the expected number of entries, fails otherwise.
var sut = new int[10];
// this check succeeds
Check.That(sut).HasSize(10);
// this check fails
Check.That(sut).HasSize(11);Checks that the sut is has no entry, fails otherwise.
var sut = new int[0];
// this checks succeed
Check.That(sut).IsNullOrEmpty();
// this check fails
Check.That(new int[1]).IsNullOrEmpty();Checks that the sut is a null reference or has no entry, fails otherwise.
var sut = new int[0];
IEnumerable nullArray = null;
// those checks succeed
Check.That(sut).IsNullOrEmpty();
Check.That(nullArray).IsNullOrEmpty();
// this check fails
Check.That(new int[1]).IsNullOrEmpty();Checks that sut contains all provided entries. Duplicates value are allowed. Fails if any entry is absent from the enumeration.
var integers = new[] { 1, 2, 3, 4, 5, 666 };
// this check succeeds
Check.That(integers).Contains(3, 5, 666);
// this check fails
Check.That(integers).Contains(3, 5, 666, 0);- Welcome
- How to start
- Customising error messages
-
Check.That
- All (Equality, Type)
- Reference types
- Members based
- IEnumerable (Properties, Content, Elements)
- String (Properties, Content, RegExp )
- Numeric Type(Properties, Comparisons, Floating)
- Dictionary
- Char (Properties, Value)
- IComparable
- DateTime
- DateTimeOffset
- Misc: Boolean, TimeSpan, Stream, Enum, EventWaitHandle
- Check.ThatCode
- Check.ThatDynamic
- Extensibility
- Auxiliary types (TimeUnit)
- Mocks