Shouldly
Search
⌃K

OfType

ShouldBeOfType is the inverse of ShouldNotBeOfType.

ShouldBeOfType

var theSimpsonsDog = new Cat { Name = "Santas little helper" };
theSimpsonsDog.ShouldBeOfType<Dog>();
Exception
theSimpsonsDog
should be of type
Simpsons.Dog
but was
Simpsons.Cat

ShouldNotBeOfType

var theSimpsonsDog = new Cat { Name = "Santas little helper" };
theSimpsonsDog.ShouldNotBeOfType<Cat>();
Exception
theSimpsonsDog
should not be of type
Simpsons.Cat
but was
Santas little helper
Last modified 5mo ago