Repository navigation
All types
The following checks are available for objects of any type.
- IsEqualTo
Checks if the given value is equal to the expected value, fails otherwise.
var sut = "myResult";
// This one succeeds
Check.That(sut).IsEqualTo("myResult");
// This one fails
Check.That(sut).IsEqualTo("MyResult");Note: the comparison algorithm can be controlled through configuration.
- IsNotEqualTo
Checks if the given value is different to the reference value, fails otherwise.
var sut = "myResult";
// This one succeeds
Check.That(sut).IsNotEqualTo("TheResult");
// This one fails
Check.That(sut).IsNotEqualTo("myResult");Note: the comparison algorithm can be controlled through configuration.
- HasSameValueAs
Checks if the given value is equal to the expected value, fails otherwise. Comparison is done using operator==.
var sut = "myResult";
// This one succeeds
Check.That(sut).HasSameValueAs("myResult");
// This one fails
Check.That(sut).HasSameValueAs("MyResult");- HasDifferentValueThan
Checks if the given value is different to the reference value, fails otherwise. Comparison is done using operator!=.
var sut = "myResult";
// This one succeeds
Check.That(sut).HasDifferentValueThan("TheResult");
// This one fails
Check.That(sut).HasDifferentValueThan("myResult");- IsInstanceOf<Type>, IsInstanceOfType(Type)
Checks if the given value is an instance of the specified type, fails otherwise. This check existin generic and non generic format.
var sut = "myResult";
// Those one succeed
Check.That(sut).IsInstanceOf<string>();
Check.That(sut).IsInstanceOfType(typeof(string));
// This one fails
Check.That(sut).IsInstanceOf<int>();- IsNotInstanceOf<Type>, IsNotInstanceOfType(Type)
Checks if the given value is not an instance of the specified type, fails otherwise. This check existin generic and non generic format.
var sut = "myResult";
// Those one succeed
Check.That(sut).IsNotInstanceOf<int>();
Check.That(sut).IsNotInstanceOfType(typeof(int));
// This one fails
Check.That(sut).IsNotInstanceOf<string>();- InheritsFrom<Type>
Checks if the given value is inherits from the given type, fails otherwise.
var sut = "myResult";
// This one succeeds
Check.That(sut).InheritsFrom<object>();
// This one fails
Check.That(sut).InheritsFrom<int>();- 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