title: Cannot access to simple file "because it is being used by another process"
body: <p>I have a simple method in my class EDIDocument used to load a xml :</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Method used to load specific target file as template
      /// &lt;/summary&gt;
      /// &lt;param name="filepath"&gt;file path&lt;/param&gt;
      /// &lt;returns&gt;loading status&lt;/returns&gt;
      public bool Load(string filepath)
      {
          //file exists
          bool returnValue = File.Exists(filepath);
          //file is a xml
          returnValue &amp;= Path.GetExtension(filepath).Equals(".xml");
          //if file is valid
          if (returnValue)
          {
              XmlReader reader = XmlReader.Create(filepath);
              //load document
              this._xmldoc = XDocument.Load(reader);
              //load complete
              returnValue &amp;= (this._xmldoc != null);
          }
          //End of method
          return returnValue;
      }
  </code></pre>
  
  <p>I have a unit test for this method : </p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Test success on load xml document
      /// &lt;/summary&gt;
      [TestMethod]
      public void TestLoadXML_Success()
      {
          File.Create("xml.xml");
          //create document
          EDIDocument doc = new EDIDocument();
          //load something wrong
          bool result = doc.Load("xml.xml");
          //test
          Assert.IsTrue(result);
      }
  </code></pre>
  
  <p>I have always an exception when i start my unit test : </p>
  
  <p>Test method EDIDocumentTest.TestLoadXML_Success threw exception: 
  System.IO.IOException: The process cannot access the file 'C:......\Debug\xml.xml' <strong>because it is being used by another process</strong>.</p>
  
  <p>I have googled this issue and i have tried multiple solution with XmlReader, StreamReader... by i have always the same exception...</p>
  
  <p>My question is : what to do into my method Load for to fix this exception?</p>
  
  <p>Thanks</p>