public void ZipFileObjectDirectories() { IIoRepository repo = new IoRepository(); FileInfo zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip")); System.IO.File.CreateText(path.Combine(TestDir.FullName, "test2.txt")).Close(); TestZip.AddFile(path.Combine(TestDir.FullName, "test2.txt"), "projects"); TestZip.Save(); foreach (var entry in TestZip.Entries) { Debug.WriteLine("Zip entry name: " + entry.FileName); } Debug.WriteLine(""); using (var zipObject = new ZipFileObject(zipFileInfo, repo)) { foreach (var item in zipObject.GetContents()) { Debug.WriteLine(item.FullName); } Assert.AreEqual(2, zipObject.GetContents().Count(), "should be 2 root objects"); Assert.AreEqual(1, zipObject.GetDirectories().Count(), "should be 1 root dir"); Assert.AreEqual(1, zipObject.GetFiles().Count(), "should be 1 root file"); } }
public void ZipFileObjectRetrievesObjects() { IIoRepository repo = new IoRepository(); FileInfo zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip")); using (var zipObject = new ZipFileObject(zipFileInfo, repo)) { Assert.AreEqual(0, zipObject.GetContents().Count(), "should be no root objects"); } }
public ZipEntryFileObject(ZipEntry zipEntry, ZipFileObject owner) : base(zipEntry) { _Owner = owner; }
public void CanCreateZipFileObject() { IIoRepository repo = new IoRepository(); FileInfo zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip")); var zipObject = new ZipFileObject(zipFileInfo, repo); }