Skip to content
Cyrille DUPUYDAUBY edited this page Feb 4, 2018 · 6 revisions

Checks on properties

IsEmpty()

Checks if the string is empty, fails if null or not empty.

// this check succeeds
Check.That("").IsEmpty();
// this check fails
Check.That("test").IsEmpty;

IsNullOrEmpty()

Checks if the string is empty or is null, fails if not empty.

// this check succeeds
Check.That("").IsNullOrEmpty();
// this check fails
Check.That("test").IsNullOrEmpty;

IsNotEmpty(), HasContent()

Checks if the string does contain texts, fails if empty or null.

// those checks succeed
Check.That("test").IsNotEmpty();
Check.That("test").HasContent();
// those checks fail
Check.That("").IsNotEmpty;
Check.That("").HasContent;

Checks on content

Contains(expected)

Checks that the sut contains expected, fails if expected is not found.

// those checks succeed
Check.That("this is a test").Contains("test");
// those checks fail
Check.That("this is a test").Contains("check");

DoesNotContain(reference)

Checks that the sut does not contain reference, fails if reference is found.

// those checks succeed
Check.That("this is a test").Contains("check");
// those checks fail
Check.That("this is a test").Contains("test");

Clone this wiki locally