Skip to content
Cyrille DUPUYDAUBY edited this page Jul 20, 2019 · 2 revisions

Check.ThatDynamic allows to perform basic checks on Dynamics.

IsNotNull()

Checks that the sut is a non null dynamic.

dynamic sut = "someDynamic";
// This check succeeds
Check.ThatDynamic(sut).IsNotNull();
// This check fails
Check.ThatDynamic(null).IsNotNull();

IsSameReferenceAs(expected)

Checks that the sut has the expected reference; fails otherwise.

dynamic sut = "someDynamic";
// This check succeeds
Check.ThatDynamic(sut).IsSameReferenceAs(sut);
// This check fails
Check.ThatDynamic(sut).IsSameReferenceAs("other");

IsEqualTo(expected)

Checks that the sut is equal to _expected; fails otherwise.

dynamic sut = "someDynamic";
// This check succeeds
Check.ThatDynamic(sut).IsEqualTo("someDynamic");
// This check fails
Check.ThatDynamic(sut).IsEqualTo("other");
Clone this wiki locally