title: NUnit equivalent of JUnit's Rule
body: <p>Is there an equivalent of JUnit's Rule in C# ? I mean a way to avoid the repetition the same <code>[SetUp]</code> and <code>[TearDown]</code> lines in several different tests. Instead of:</p>
  
  <pre class="lang-csharp prettyprint-override"><code>[SetUp]
  public void SetUp()
  {
      myServer.connect();
  }
  
  [TearDown]
  public void TearDown()
  {
      myServer.disconnect();
  }
  </code></pre>
  
  <p>... put the logic in a rule that can be declared as field in several tests:</p>
  
  <pre class="lang-java prettyprint-override"><code>public MyRule extends ExternalResource {
    @Override
    protected void before() throws Throwable
    {
      myServer.connect();
    };
  
    @Override
    protected void after()
    {
      myServer.disconnect();
    };
  };
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>class TestClass
  {
      @Rule MyRule = new MyRule();
      ...
  }
  </code></pre>