Null and Empty

ShouldBeNull

var target = "Homer";
target.ShouldBeNull();

snippet source | anchor

Exception

target
    should be null but was
"Homer"

ShouldBeNullOrEmpty

var target = "Homer";
target.ShouldBeNullOrEmpty();

snippet source | anchor

Exception

target ("Homer")
    should be null or empty

ShouldBeEmpty

var target = "Homer";
target.ShouldBeEmpty();

snippet source | anchor

Exception

target
    should be empty but was
"Homer"

ShouldNotBeNull

string? target = null;
target.ShouldNotBeNull();

snippet source | anchor

Exception

target
    should not be null but was

ShouldNotBeNullOrEmpty

var target = "";
target.ShouldNotBeNullOrEmpty();

snippet source | anchor

Exception

target ("")
    should not be null or empty

ShouldNotBeEmpty

var target = "";
target.ShouldNotBeNullOrEmpty();

snippet source | anchor

Exception

target
    should not be empty but was

Last updated