NotBe
ShouldNotBe is the inverse of ShouldBe.
Objects
ShouldNotBe works on all types and compares using .Equals.
var theSimpsonsCat = new Cat { Name = "Santas little helper" };
theSimpsonsCat.Name.ShouldNotBe("Santas little helper");Exception
theSimpsonsCat.Name
should not be
"Santas little helper"
but wasNumeric
ShouldNotBe also allows you to compare numeric values, regardless of their value type.
Integer
const int one = 1;
one.ShouldNotBe(1);Exception
Long
Exception
DateTime(Offset)
ShouldNotBe DateTime overloads are similar to the numeric overloads and also support tolerances.
Exception
TimeSpan
TimeSpan also has tolerance overloads
Exception
Last updated