Skip to content
Cyrille DUPUYDAUBY edited this page Jan 31, 2018 · 15 revisions

The following checks are available for objects of any type.

Equality

  • IsEqualTo

Check 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

Check 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

Check 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

Check 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");

Clone this wiki locally