c void ExpectAnExceptionByType()
    { /* ... */ }

    [Test]
    [ExpectedException("System.InvalidOperationException")]
    public void ExpectAnExceptionByName()
    { /* ... */ }
  }
}
</pre>

<pre class="prettyprint vb">Imports System
Imports Nunit.Framework

Namespace Nunit.Tests

  &lt;TestFixture()&gt; Public Class SuccessTests
    &lt;Test(), ExpectedException(GetType(Exception))&gt;
      Public Sub ExpectAnExceptionByType()
    &#39; ...
    End Sub

  &lt;TestFixture()&gt; Public Class SuccessTe