예제 #1
0
 public void Entries_ShouldContain_ZipArchiveEntries()
 {
     using (var instance = zipfile.Open(ArchiveFileName, System.IO.Compression.ZipArchiveMode.Read))
     {
         Assert.IsNotNull(instance.Entries);
         CollectionAssert.IsNotEmpty(instance.Entries);
     }
 }
예제 #2
0
        public void Open_Creates_ZipArchiveWrap()
        {
            var instance = new ZipFileWrap();

            instance.CreateFromDirectory(ArchiveDirectory, ArchiveFileName);
            using (var archive = instance.Open(ArchiveFileName, System.IO.Compression.ZipArchiveMode.Read))
            {
                Assert.IsNotNull(archive);
                Assert.IsInstanceOf <ZipArchiveWrap>(archive);
            }
        }
예제 #3
0
        public void Open_WithUTF8Encoding_Creates_OpensZipWithCorrectEncoding()
        {
            var assembly     = Assembly.GetAssembly(typeof(ZipFileWrapTests));
            var testFilePath = assembly.CodeBase.Substring(8);  //remove the "file://" from the front

            testFilePath = Path.GetDirectoryName(testFilePath) + @"\TestData\Encoding_UTF8.zip";

            var instance = new ZipFileWrap();

            using (var archive = instance.Open(testFilePath, System.IO.Compression.ZipArchiveMode.Read, Encoding.UTF8))
            {
                Assert.IsNotNull(archive);
                Assert.IsInstanceOf <ZipArchiveWrap>(archive);

                var entry = archive.Entries.First();
                Assert.AreEqual("text-ľščťžýáíé.txt", entry.Name);
            }
        }