public void Upload_pdf_copyHandle()
        {
            _docs.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("docs_to_copy")).Wait();
            Thread.Sleep(2000);
            _docs.CopyHandleAsync(DocumentHandle.FromString("docs_to_copy"), DocumentHandle.FromString("docs_to_copy_copied")).Wait();

            _demo.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("demo_to_copy")).Wait();
            Thread.Sleep(2000);
            _demo.CopyHandleAsync(DocumentHandle.FromString("demo_to_copy"), DocumentHandle.FromString("demo_to_copy_copied")).Wait();
        }
Пример #2
0
        public async Task upload_copy_handle_then_delete_original_handle()
        {
            var handle       = DocumentHandle.FromString("PdfHandleToCopy");
            var copiedHandle = DocumentHandle.FromString("PdfHandleCopied");

            await _documentStoreClient.UploadAsync(
                TestConfig.PathToDocumentPdf,
                handle,
                new Dictionary <string, object> {
                { "callback", "http://localhost/demo" }
            }
                );

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

            await _documentStoreClient.CopyHandleAsync(handle, copiedHandle);

            await UpdateAndWaitAsync().ConfigureAwait(false);

            await _documentStoreClient.DeleteAsync(handle);

            await UpdateAndWaitAsync().ConfigureAwait(false);

            // check readmodel
            var tenantAccessor = ContainerAccessor.Instance.Resolve <ITenantAccessor>();
            var tenant         = tenantAccessor.GetTenant(new TenantId(TestConfig.Tenant));
            var docReader      = tenant.Container.Resolve <IMongoDbReader <DocumentDescriptorReadModel, DocumentDescriptorId> >();

            var allDocuments = docReader.AllUnsorted;

            Assert.AreEqual(1, allDocuments.Count());
            var singleDoc = docReader.AllUnsorted.Single();

            Assert.That(singleDoc.Documents.Select(h => h.ToString()), Is.EquivalentTo(new[] { copiedHandle.ToString() }));
        }
 public void Upload_pdf_copyHandle()
 {
     _docs.CopyHandleAsync(DocumentHandle.FromString("Rev_1"), DocumentHandle.FromString("Rev_1_copied")).Wait();
 }