title: How to force a MSTEST TestMethod to reset all singletons/statics before running?
body: <p>I'm using MSTEST inside Visual Studio 2008. How can I have each unit test method in a certain test class act as if it were the first test to run so that all global state is reset before running each test? I do not want to explicitly clean up the world using TestInitialize, ClassInitialize, AssemblyInitialize, etc. For example:</p>
  
  <pre><code>[TestClass]
  public class MyClassTests
  {
      [TestMethod]
      public void Test1()
      {
         // The "Instance" property creates a new instance of "SomeSingleton"
         // if it hasn't been created before.
         var i1 = SomeSingleton.Instance;
         ...
      }
      [TestMethod]
      public void Test2()
      {
         // When I select "Test1" and "Test2" to run, I'd like Test2
         // to have a new AppDomain feel so that the static variable inside
         // of "SomeSingleton" is reset (it was previously set in Test1) on
         // the call to ".Instance"
         var i2 = SomeSingleton.Instance;
         // some code
      }
  </code></pre>
  
  <p>Although a <a href="https://stackoverflow.com/questions/154180/how-does-nunit-and-mstest-handle-tests-that-change-staticshared-variables">similar question</a> appeared on this topic, it only clarified that tests do not run in parallel. I realize that tests run serially, but there doesn't seem to be a way to explicitly force a new AppDomain for each method (or something equivalent to clear all state).</p>
  
  <p>Ideally, I'd like to specify this behavior for only a small subset of my unit tests so that I don't have to pay the penalty of a new AppDomain creation for tests that don't care about global state (the vast majority of my tests).</p>