Take the 2-minute tour ×

I know how to write this using Nunit,

Assert.That(exception, Is.InstanceOfType(typeof(TypeNotRegisteredException)));

How can I write the same thing using in Xunit, as Xunit does not have Assert.That.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

You might be looking for:


Let me know if this is close to what you're looking for.

share|improve this answer
Thanks Matt. It is what I was looking for. –  DoodleKana Jun 4 '13 at 17:37
add comment

I am thinking you are asking what is the equivalent of the InstanceOfType assert rather than the equivalent of Assert.That. The latter is just a better syntax that enables you to read your asserts like English.

The equivalent of InstanceOfType assert in Xunit is IsType:


Note that the nunit equivalent is, indeed:


(the older IsInstanceOfType assert is deprecated - http://www.nunit.org/index.php?p=typeAsserts&r=2.5.1 )

share|improve this answer
add comment

Your Answer


