Shouldly
Search…
OfType
ShouldBeOfType is the inverse of ShouldNotBeOfType.

ShouldBeOfType

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

ShouldNotBeOfType

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