Skip to content

InstanceOfTypeConstraint

jnm2 edited this page Jun 14, 2017 · 4 revisions

InstanceOfTypeConstraint tests that an object is of the type supplied or a derived type.

Constructor

InstanceOfTypeConstraint(Type)

Syntax

Is.InstanceOf(Type)
Is.InstanceOf<T>()

Examples of Use

Assert.That("Hello", Is.InstanceOf(typeof(string)));
Assert.That(5, Is.Not.InstanceOf(typeof(string)));

Assert.That(5, Is.Not.InstanceOf<string>());
Clone this wiki locally