Esempio n. 1
0
 public void UnzipFilesThrowsOnNullArgument()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         var _ = FileZipper.UnzipFiles(null).ToList();
     });
 }
Esempio n. 2
0
 public void UnizipFilesThrowsIfStreamIsEmpty()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         using (var stream = new MemoryStream())
         {
             var _ = FileZipper.UnzipFiles(stream).ToList();
         }
     });
 }
Esempio n. 3
0
        public void FilesOfArchiveAreWrittenIntoMemory()
        {
            var unzippedFiles = new List <FileInfo>();

            using (var archive = this.CreateArchiveFromTemporaryFiles())
            {
                foreach (var singleFileStream in FileZipper.UnzipFiles(archive))
                {
                    using (singleFileStream)
                    {
                        var path = Path.GetTempFileName();
                        this.tempTestFiles.AddFile(path, false);
                        File.WriteAllBytes(path, singleFileStream.ToArray());
                        unzippedFiles.Add(new FileInfo(path));
                    }
                }
            }

            Assert.IsTrue(unzippedFiles.All(f => f.Exists));
        }