title: How do I mock an IEnumerable<T> so that I can test a method that receives it
body: <p>I have a method that I want to test which expects an <code>IEnumerable&lt;T&gt;</code> as a parameter.</p>
  
  <p>I'm currently mocking the contents of the <code>IEnumerable&lt;T&gt;</code> as follows (Using Moq):</p>
  
  <pre><code> var mockParent = new Mock&lt;ICsvTreeGridExportable&gt;();
   var mockChild = new Mock&lt;ICsvTreeGridExportable&gt;();
  </code></pre>
  
  <p>How do it put these mocked objects inside an <code>IEnumerable&lt;T&gt;</code> so that I can pass them as a parameter to the method I want to test?</p>
  
  <p>The method I'm testing expects to receive an <code>IEnumerable&lt;ICsvTreeGridExportable&gt;</code></p>