title: How to do integration testing in .NET with real files?
body: <p>I have some classes that implements some logic related to file system and files. For example, I am performing following tasks as part of this logic:</p>
  
  <ul>
  <li>checking if certain folder has certain structure (eg. it contains subfolders with specific names etc...)</li>
  <li>loading some files from those folders and checking their structure (eg. these are some configuration files, located at certain place within certain folder)</li>
  <li>load additional files for testing/validation from the configuration file (eg. this config file contains information about other files in the same folder, that should have other internal structure etc...)</li>
  </ul>
  
  <p>Now all this logic has some workflow and exceptions are thrown, if something is not right (eg. configuration file is not found at the specific folder location). In addition, there is <a href="http://msdn.microsoft.com/en-us/library/dd460648%28v=vs.110%29.aspx" rel="noreferrer">Managed Extensibility Framework (MEF)</a> involved in this logic, because some of these files I am checking are managed DLLs that I am manually loading to MEF aggregates etc...</p>
  
  <p>Now I'd like to test all this in some way. I was thinking of creating several physical test folders on HDD, that cover various test cases and then run my code against them. I could create for example:</p>
  
  <ul>
  <li>folder with correct structure and all files being valid</li>
  <li>folder with correct structure but with invalid configuration file</li>
  <li>folder with correct structure but missing configuration file
  etc...</li>
  </ul>
  
  <p>Would this be the right approach? I am not sure though how exactly to run my code in this scenario... I certainly don't want to run the whole application and point it to check these mocked folders. Should I use some unit testing framework to write kind of "unit tests", that executes my code against these file system objects? </p>
  
  <p>In general, is all this a correct approach for this kind of testing scenarios? Are there other better approaches?</p>