title: nunit/mbunit parameterized SetUp
body: <p>I'd like to provide parameterized data for the <strong>setup</strong> of a test. Something like this:</p>
  
  <pre><code>[TestCase("1", "2")
  [TestCase("a", "b")
  public class TestFixture
  {
      [SetUp]
      public void SetUp(string x, string y)
      {
          Console.WriteLine("Setup with {0}, {1}", x, y);
      }
  
      [Test]
      public void Test() {...}
  }
  </code></pre>
  
  <p>But I can only manage to get parameters passed to the testcase itself.</p>
  
  <p>I prefer solutions for either <strong>nunit</strong> or <strong>mbunit</strong> but open for alternatives (yet to settle on which test framework to use). This is ultimately for a set of Selenium system-tests where the setup creates a browser session.</p>
  
  <p>[edit]
  Using NUnit I can get this working:</p>
  
  <pre><code>[TestFixture("1", "2")]
  [TestFixture("a", "b")]
  public class Tests
  {
      private string _x;
      private string _y;
  
      public Tests(string x, string y)
      {
          _x = x;
          _y = y;
      }
  
      [SetUp]
      public void SetUp()
      {
          Console.WriteLine("Setup with {0}, {1}", _x, _y);
      }
  
      [Test]
      public void Test()
      {
  
      }
  }
  </code></pre>
  
  <p>[/edit]</p>
  
  <p>That seems to suit my needs, but I'll leave the question open for a few days to see if alternatives are suggested.</p>