Skip to content
grahamrhay edited this page Nov 11, 2010 · 1 revision

#IsInstanceOf

Matches if an item is an instance of a specified type (using Type.IsInstanceOfType):

    [Test]
    public void IsInstanceOf()
    {
        var isAnOrange = new IsInstanceOf<Orange>();

        Assert.That(new Orange(), isAnOrange);
        // or alternatively
        Assert.That(new Orange(), Is.InstanceOf(typeof(Fruit)));
    }

    public class Fruit { }

    public class Orange : Fruit { }
Clone this wiki locally