Shouldly
Search…
Null and Empty

ShouldBeNull

1
var target = "Homer";
2
target.ShouldBeNull();
Copied!
Exception
1
target
2
should be null but was
3
"Homer"
Copied!

ShouldBeNullOrEmpty

1
var target = "Homer";
2
target.ShouldBeNullOrEmpty();
Copied!
Exception
1
target ("Homer")
2
should be null or empty
Copied!

ShouldBeEmpty

1
var target = "Homer";
2
target.ShouldBeEmpty();
Copied!
Exception
1
target
2
should be empty but was
3
"Homer"
Copied!

ShouldNotBeNull

1
string? target = null;
2
target.ShouldNotBeNull();
Copied!
Exception
1
target
2
should not be null but was
Copied!

ShouldNotBeNullOrEmpty

1
var target = "";
2
target.ShouldNotBeNullOrEmpty();
Copied!
Exception
1
target ("")
2
should not be null or empty
Copied!

ShouldNotBeEmpty

1
var target = "";
2
target.ShouldNotBeNullOrEmpty();
Copied!
Exception
1
target
2
should not be empty but was
Copied!
Last modified 1yr ago