8000 Type expectations · fluffynuts/NExpect Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
< 8000 template class="js-flash-template">

Type expectations

Davyd McColl edited this page Oct 14, 2017 · 2 revisions

You can test the type of an object:

Expect(obj).To.Be.An.Instance.Of<IInterface>();
Expect(obj).To.Be.An.Instance.Of<BaseClass>();

Often I find I want to do this testing before I'm even writing tests with constructed SUT objects, for example, I want a test which shows that I intend to implement an interface or inherit from a base class:

var sut = typeof(SomeClass);
Expect(sut).To.Implement<IInterface>();
Expect(sut).To.Inherit<BaseClass>();
Clone this wiki locally
0