// [Test] public void TestPdfDoesntOverwriteOtherFileWithSameName() { var attachment = new ProtectAttachment(TestUtils.CreateAttachment("FilesWithSameName.zip", "FilesWithSameName.zip", "1")); var attachments = new ObservableCollection<IProtectAttachment>() { attachment }; var actionQueue = new ActionQueue(); bool discoveryCompleted = false; bool appliedAllActions = false; actionQueue.StatusUpdate += (sender, args) => { if (args.Status == PropertyNames.DiscoveryCompleted) { discoveryCompleted = true; } if (args.Status == PropertyNames.AppliedAllActions) { appliedAllActions = true; } }; actionQueue.Discover(attachments.ToList()); SpinWait.SpinUntil(() => discoveryCompleted, 90000); Assert.IsTrue(discoveryCompleted, "Discovery failed to complete."); var xlsx = attachment.Children.First(x => x.FileName.Contains(".xlsx")); var options = new Dictionary<string, dynamic> {{PropertyNames.PdfFormat, PropertyValues.PdfA}}; var pdf = WorkshareTaskFactory.CreatePdfTask(xlsx, options); var task = new TaskRepack(attachments); actionQueue.ApplyTasks(new List<IWorkshareTask>() { pdf, task }); SpinWait.SpinUntil(() => appliedAllActions, 90000); Assert.IsTrue(appliedAllActions, "Failed to apply all actions within the time limit"); new Workshare.API.Cleaning.OfficeApplicationCacheControl().ReleaseOfficeApplications(); VerifyFilesAreNotEqual(attachment.FileName); SpinWait.SpinUntil(TestUtils.HasOfficeShutDown, 60000); }
public void TestRepackingDoesntWipeoutContentsOfEncryptedZip() { var attachments = new ObservableCollection<IProtectAttachment>() { new ProtectAttachment(TestUtils.CreateAttachment("password.zip", "password.zip", "1")) }; var repack = new TaskRepack(attachments); repack.Execute(new CancellationToken()); var zipFile = attachments.First().FileName; Assert.IsTrue(ZipContains(zipFile, "test v1rtf1.rtf")); }