title: How do I mock Directory.GetFiles?
body: <p>I am trying to figure out how or if it is possible to do the following with Moq</p>
  
  <pre><code>public class Download
  {
      private IFoo ifoo;
  
      public Download(IFoo ifoo)
      {
          this.ifoo = ifoo;
      }
  
      public void Download()
      {
          var files = Directory.GetFiles("filepath"); //&lt;&lt;&lt;===
  
          foreach (var item in files)
          {
  
              // do something
  
          }    
      }
  }
  </code></pre>
  
  <p>In unit test. </p>
  
  <pre><code>// Arrange 
  
  var mockFoo = new Mock&lt;IFoo&gt;();
  mockFoo.setup( s =&gt; s.Bar()).returns(true);
  
  var foo = new Foo(mockFoo.Object);
  
  // Act
  foo.Download()
  </code></pre>
  
  <p>How can I mock the <code>files</code> variable, so the method uses the mock version. Is this even the correct approach? As I am not mocking the class, and rather mocking the dependency how do I go about settings the files variable so it looks at mocked file string[].</p>