public void AddToEmptyArchive() { string tempFile = GetTempFilePath(); Assert.IsNotNull(tempFile, "No permission to execute this test?"); string addFile = Path.Combine(tempFile, "a.dat"); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { MakeTempFile(addFile, 1); try { tempFile = Path.Combine(tempFile, "SharpZipTest.Zip"); using (IsolatedZipFile f = IsolatedZipFile.Create(tempFile)) { f.BeginUpdate(); f.Add(addFile); f.CommitUpdate(); Assert.AreEqual(1, f.Count); // TODO: Testing is not yet ported - Assert.IsTrue(f.TestArchive(true)); } using (IsolatedZipFile f = new IsolatedZipFile(tempFile)) { Assert.AreEqual(1, f.Count); f.BeginUpdate(); f.Delete(f[0]); // failing here in 4 and 3 - fixed - one-off in zipfile f.CommitUpdate(); Assert.AreEqual(0, f.Count); // TODO: Testing is not yet ported - Assert.IsTrue(f.TestArchive(true)); f.Close(); } store.DeleteFile(tempFile); } finally { store.DeleteFile(addFile); } } }
public void AddAndDeleteEntries() { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { string tempFile = GetTempFilePath(); Assert.IsNotNull(tempFile, "No permission to execute this test?"); string addFile = Path.Combine(tempFile, "a.dat"); MakeTempFile(addFile, 1); string addFile2 = Path.Combine(tempFile, "b.dat"); MakeTempFile(addFile2, 259); tempFile = Path.Combine(tempFile, "SharpZipTest.Zip"); using (IsolatedZipFile f = IsolatedZipFile.Create(tempFile)) { f.BeginUpdate(); f.Add(addFile); f.Add(addFile2); f.CommitUpdate(); // TODO: Testing is not yet ported - Assert.IsTrue(f.TestArchive(true)); } using (IsolatedZipFile f = new IsolatedZipFile(tempFile)) { Assert.AreEqual(2, f.Count); // TODO: Testing is not yet ported - Assert.IsTrue(f.TestArchive(true)); f.BeginUpdate(); f.Delete(f[0]); f.CommitUpdate(); Assert.AreEqual(1, f.Count); // TODO: Testing is not yet ported - Assert.IsTrue(f.TestArchive(true)); } store.DeleteFile(addFile); store.DeleteFile(addFile2); store.DeleteFile(tempFile); } }