title: Unit Testing using Shims for ZipFile
body: <p>I'm attempting to unit test some code that use ZipFile.OpenRead within to extract some XML files from a ZIP (Writing the unit tests with moq)</p>
  
  <p>Is there a way I can replace the call to ZipFile.OpenRead with my own result? I have used shims for similar situations, but I can't figure out what to do in this situation and documentation on shims is pretty sparse.</p>
  
  <p>Here is (part of) the method that needs unit-testing:</p>
  
  <pre><code>    public IEnumerable&lt;ConfigurationViewModel&gt; ExtractXmlFromZip(string fileName)
      {
          var configs = new List&lt;ConfigurationViewModel&gt;();
          using (var archive = ZipFile.OpenRead(fileName))
          {
              foreach (ZipArchiveEntry entry in archive.Entries)
              {
                  if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
                  {
                      LoadConfigfromZipArchiveEntry(entry, configs)
                  }
              }
          }
          return configs;
     }
  </code></pre>