Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. C# Unit testing, using XML from a zip file
  2. // Not sure how to do this
  3. List<byte[]> scripts = GetTheScriptsSomehow();
  4.  
  5. foreach(var script in scripts )
  6. {
  7.   var parsedScript = ScriptParser.Parse(script);
  8.   Assert.AreEqual(parsedScript.Blah, "BLAH");
  9. }
  10.        
  11. ZipInputStream zip = new ZipInputStream(new MemoryStream(Properties.Resources.scripts));
  12. while (zip.GetNextEntry() != null)
  13. {
  14.   MemoryStream data = new MemoryStream();
  15.   zip.CopyTo(data);
  16.   data.Position = 0;
  17.   string scriptContents = new StreamReader(data).ReadToEnd();
  18.   /// do something with scriptContents variable
  19. }