示例#1
0
        public async Task Removing_format_from_document()
        {
            //Upload original
            var handle = new DocumentHandle("Add_Format_Test");
            await _documentStoreClient.UploadAsync(TestConfig.PathToOpenDocumentText, handle);

            // wait background projection polling
            await UpdateAndWaitAsync().ConfigureAwait(false);

            //now add format to document.
            AddFormatFromFileToDocumentModel model = new AddFormatFromFileToDocumentModel();

            model.DocumentHandle = handle;
            model.PathToFile     = TestConfig.PathToTextDocument;
            model.CreatedById    = "tika";
            model.Format         = new DocumentFormat("tika");
            await _documentStoreClient.AddFormatToDocument(model, new Dictionary <String, Object>());

            // wait background projection polling
            await UpdateAndWaitAsync().ConfigureAwait(false);

            //now delete format
            await _documentStoreClient.RemoveFormatFromDocument(handle, new DocumentFormat("tika")).ConfigureAwait(false);

            await UpdateAndWaitAsync().ConfigureAwait(false);

            var formats = await _documentStoreClient.GetFormatsAsync(handle).ConfigureAwait(false);

            Assert.NotNull(formats);
            Assert.IsTrue(formats.HasFormat(new DocumentFormat("original")));
            Assert.That(formats, Has.Count.EqualTo(1), "Tika format should be removed from the projection");

            //Uncomment the test if you want to verify that blob id is deleted from a projection
            //Assert.Throws<Exception>(() => _blobStore.GetDescriptor(blobId), "Blob Id for artifact is not deleted");
        }
 public void Remove_tika_from_pdf()
 {
     _docs.RemoveFormatFromDocument(DocumentHandle.FromString("Rev_1"), new DocumentFormat("tika")).Wait();
 }