title: When multiple unit tests copy the same file, running all unit tests fail
body: <p><strong>Description</strong></p>
  
  <p>I am writing unit tests for a method, which copies a file from a source to a destination. Basically it includes this code:</p>
  
  <pre><code>public void MyMethod() 
  {
      // ...
      File.Copy(source, destination, true);
      // ...
  }
  </code></pre>
  
  <p>In my unit test project, I have a test file: (<code>test.png</code>), which is located in the <code>Resources</code> folder of my unit test project. And I've set the <code>Copy to Output</code> property to <code>Always</code>. </p>
  
  <p>I have 3 unit tests which are testing this method.</p>
  
  <p>When they hit the line of the code which copies the file: <code>source = "Resources\\test.png"</code>.</p>
  
  <p><strong>Issue</strong></p>
  
  <p>When I run the unit test individually, they all pass and everything is fine.
  However, when I run All Tests in Visual Studio, I get this run time error and unit tests fail:</p>
  
  <blockquote>
    <p>System.IO.DirectoryNotFoundException</p>
    
    <p>Could not find a part of the path 'Resources\test.png'.</p>
  </blockquote>
  
  <p><strong>My Thoughts...(UPDATED)</strong></p>
  
  <ul>
  <li><p>Probably because Visual Studio runs each unit tests simultaneously in a separate thread and they all accessing the same file at the same time?</p></li>
  <li><p>I think for every unit test, Visual Studio is cleaning <code>bin/Debug</code> and <code>bin/Release</code> folders. Then it copies all the required project files in that folder. This causes sometimes the file actually does not exist?</p></li>
  </ul>
  
  <p><strong>Question</strong></p>
  
  <p>How can I fix this problem?</p>
  
  <p>Is there any settings of configurations to resolve this? </p>
  
  <p>How can I run all unit tests in Visual Studio (and Team City) when multiple unit tests are accessing the same file?</p>