title: Unit test with static value
body: <p>I will try to simplify problem I have with unit tests.</p>
  
  <p>I am testing methods with static private field. If I run test than I must be able predict what is value for static field. This is not problem when I have one test, or if I run tests one by one. Than everything is working fine.</p>
  
  <p>Problem is when I have more than one unit test which change static value and run them all.
  In case like this only first test will pass and all others will fall.</p>
  
  <p>This is simplified example:</p>
  
  <pre><code>using Xunit;
  
  namespace My.Unit
  {
      public class UnitTests
      {
          [Fact]
          public void test1()
          {
              var obj = new TestClass();
              var res = obj.testMethod();
  
              Assert.Equal(1, res);
          }
  
          [Fact]
          public void test2()
          {
              var obj = new TestClass();
              var res = obj.testMethod();
  
              Assert.Equal(1, res);
          }
      }
  
      public class TestClass
      {
          private static int staticValue = 0;
          public TestClass()
          {
              ++staticValue;
          }
  
          public int testMethod()
          {
              return staticValue;
          }
      }
  }
  </code></pre>
  
  <p>I would expect from every unit test to have new lifetime for static field, but this is not case.</p>