title: C#: Unittesting with private static members?
body: <p>I have a class with a construct like this:</p>
  
  <pre><code>private static Dictionary&lt;Contract, IPriceHistoryManager&gt; _historyManagers = new Dictionary&lt;Contract, IPriceHistoryManager&gt;();
  </code></pre>
  
  <p>and lets say 2 methods like:</p>
  
  <pre><code> public void AddSth()
   {
      _historManagers.Add(new Contract(), new PriceHistoryManager());
   }
  
   public int CountDic()
   {
      return _historyManagers.Count(); 
   }
  </code></pre>
  
  <p><strong>Problem:</strong>
  When running unittests there is no way to "reset" the Dictionary and when i create multiple unittests with seperate instances of the class, then "CountDic" gives unpredictable results and i can't test the listentries.</p>
  
  <p><strong>Question:</strong>
  Is this generally considered a "bad" approach and if yes: how to do it better/more unittestable? 
  And if not: How to unittest this best?</p>
  
  <p>Thx.</p>