public async Task When_requesting_PDF_OCR_but_the_feature_is_not_licensed()
        {
            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"errorCode\":\"FeatureNotLicensed\",\"errorDetails\":{\"in\":\"body\",\"at\":\"input.dest.pdfOptions.ocr\"}}"));

            var dummyInput = new ConversionSourceDocument(new RemoteWorkFile(null, null, null, null));

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(dummyInput, new DestinationOptions(DestinationFileFormat.Pdf)
                {
                    PdfOptions = new PdfDestinationOptions
                    {
                        Ocr = new OcrOptions
                        {
                            Language = "english",
                        },
                    },
                });
            }, "Remote server is not licensed to perform OCR when producing PDF output.");
        }
        public async Task When_the_second_of_three_input_work_files_does_not_exist()
        {
            var remoteWorkFile0 = new RemoteWorkFile(null, "ML3AbF-qzIH5K9mVVxTlBX", "FCnaLL517YPRAnrcX2wlnKURpNPsp2d2pMPkcvCcpdY=", "docx");
            var remoteWorkFile1 = new RemoteWorkFile(null, "S5uCdv7vnkTRzKKlTvhtaw", "FCnaLL517YPRAnrcX2wlnKURpNPsp2d2pMPkcvCcpdY=", "docx");
            var remoteWorkFile2 = new RemoteWorkFile(null, "5J15gtlduA_xORR8j7ejSg", "FCnaLL517YPRAnrcX2wlnKURpNPsp2d2pMPkcvCcpdY=", "docx");

            var input0 = new ConversionSourceDocument(remoteWorkFile0);
            var input1 = new ConversionSourceDocument(remoteWorkFile1, pages: "2-");
            var input2 = new ConversionSourceDocument(remoteWorkFile2);

            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"input\":{\"dest\":{\"format\":\"pdf\",\"pdfOptions\":{\"forceOneFilePerPage\":false}},\"sources\":[{\"fileId\":\"LxuuLktmmMaicAs1wMvvsQ\",\"pages\":\"\"},{\"fileId\":\"S5uCdv7vnkTRzKKlTvhtaw\",\"pages\":\"2-\"},{\"fileId\":\"5J15gtlduA_xORR8j7ejSg\",\"pages\":\"\"}]},\"minSecondsAvailable\":18000,\"errorCode\":\"WorkFileDoesNotExist\",\"errorDetails\":{\"in\":\"body\",\"at\":\"input.sources[1].fileId\"}}"));

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(
                    new List <ConversionSourceDocument>
                {
                    input0, input1, input2,
                },
                    new DestinationOptions(DestinationFileFormat.Pdf));
            }, "ConversionSourceDocument at index 1 refers to a remote work file which does not exist. It may have expired.");
        }
Пример #3
0
        public async Task When_applying_a_footer_to_multiple_sources()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(
                    new List <ConversionSourceDocument>
                {
                    new ConversionSourceDocument("documents/example.pdf"),
                    new ConversionSourceDocument("documents/example.pdf"),
                    new ConversionSourceDocument("documents/example.pdf"),
                },
                    new DestinationOptions(DestinationFileFormat.Pdf)
                {
                    Footer = new HeaderFooterOptions()
                    {
                        Lines = new List <HeaderFooterLine>()
                        {
                            new HeaderFooterLine()
                            {
                                Left = "Acme"
                            },
                        },
                    },
                });
            }, "Remote server does not support applying headers or footers when using multiple ConversionSourceDocument instances. To apply headers or footers, use a single ConversionSourceDocument instance.");
        }
Пример #4
0
        public async Task When_server_supports_three_OCR_languages()
        {
            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"errorCode\":\"InvalidInput\",\"errorDetails\":{\"in\":\"body\",\"at\":\"input.dest.pdfOptions.ocr.language\",\"expected\":{\"enum\":[\"english\",\"greek\",\"hebrew\"]}}}"));

            var dummyInput = new ConversionSourceDocument(new RemoteWorkFile(null, null, null, null));

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(dummyInput, new DestinationOptions(DestinationFileFormat.Pdf)
                {
                    PdfOptions = new PdfDestinationOptions
                    {
                        Ocr = new OcrOptions
                        {
                            Language = "hylian",
                        },
                    },
                });
            }, "Unsupported OCR language \"hylian\". The remote server only supports the following OCR languages: \"english\", \"greek\", \"hebrew\".");
        }
Пример #5
0
        public async Task RedactToPlainTextAsync_fails_with_a_useful_error_message_when_the_markup_json_file_is_not_actually_JSON()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.RedactToPlainTextAsync("documents/confidential-contacts.pdf", "documents/example.docx", "\n");
            }, "The remove server was unable to burn the markup file into the document because the markup file was not valid JSON.");
        }
Пример #6
0
        public async Task BurnMarkupAsync_fails_with_a_useful_error_message_when_the_markup_json_file_is_not_actually_JSON()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.BurnMarkupAsync("documents/confidential-contacts.pdf", "documents/example.docx");
            }, "The remote server was unable to burn the markup file into the document. It is possible there is a problem with the markup JSON or with the document itself.");
        }
Пример #7
0
        public async Task BurnMarkupAsync_fails_with_a_useful_error_message_when_the_markup_json_file_contains_content_which_does_not_pass_schema_validation()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.BurnMarkupAsync("documents/confidential-contacts.pdf", "documents/content-fails-schema-validation.markup.json");
            }, "The remote server rejected the given markup JSON because it contained content which did not conform to its allowed markup JSON schema. See the markup JSON schema documentation for your version of PrizmDoc Viewer (such as https://help.accusoft.com/PrizmDoc/latest/HTML/webframe.html#markup-json-specification.html).");
        }
        public async Task RedactToPlainTextAsync_fails_with_a_useful_error_message_when_an_unsupported_line_ending_is_used()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.RedactToPlainTextAsync("documents/confidential-contacts.pdf", "documents/confidential-contacts.pdf.markup.json", "wat");
            }, "Unsupported line ending \"wat\". The remote server only supports the following values: \"\\n\", \"\\r\\n\".");
        }
        public async Task CAD_to_TIFF()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(new ConversionSourceDocument("documents/example.dwg"), new DestinationOptions(DestinationFileFormat.Tiff));
            }, "When converting a CAD ConversionSourceDocument to TIFF, you must specify TiffOptions.MaxWidth or TiffOptions.MaxHeight.");
        }
        public async Task When_using_a_single_password_protected_source_document_and_the_wrong_password_is_given()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(new ConversionSourceDocument("documents/password.docx", password: "******"), new DestinationOptions(DestinationFileFormat.Pdf));
            }, "Invalid password for ConversionSourceDocument (\"documents/password.docx\").");
        }
        public async Task BurnMarkupAsync_fails_with_a_useful_error_message_when_the_source_document_is_unusable()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.BurnMarkupAsync("documents/corrupted-page-count.pdf", "documents/confidential-contacts.pdf.markup.json");
            }, "The remote server was unable to burn the markup file into the document. It is possible there is a problem with the markup JSON or with the document itself.");
        }
        public async Task CreateRedactionsAsync_fails_with_a_useful_error_message_when_the_source_document_is_unusable()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.CreateRedactionsAsync("documents/corrupted-page-count.pdf", new[] { new RegexRedactionMatchRule("wat") });
            }, "The remote server encountered an error when trying to create redactions for the given document. There may be a problem with the document itself.");
        }
Пример #13
0
        public async Task When_using_a_single_source_input()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(new ConversionSourceDocument("documents/example.pdf", pages: "wat"), new DestinationOptions(DestinationFileFormat.Pdf));
            }, "ConversionSourceDocument (\"documents/example.pdf\") has an invalid value for \"pages\". A valid pages value is a string like \"1\", \"1,3,5-10\", or \"2-\" (just like in a print dialog).");
        }
        public async Task Unexpected_bare_418_on_POST()
        {
            mockServer
            .Given(Request.Create().WithPath("/PCCIS/V1/MarkupBurner").UsingPost())
            .RespondWith(Response.Create().WithStatusCode(418));

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() => { await prizmDocServer.BurnMarkupAsync("documents/confidential-contacts.pdf", "documents/confidential-contacts.pdf.markup.json"); },
                expectedMessage : @"Remote server returned an error: I'm a teapot",
                ignoreCase : true);
        }
        public async Task When_using_a_single_source_input()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            // This assertion is coupled to what is currently supported in the product. It would be better if we used a mock for this test.
            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(new ConversionSourceDocument("documents/example.mp3"), new DestinationOptions(DestinationFileFormat.Pdf));
            }, "Unsupported file format \"mp3\". The remote server only supports the following input file formats: \"bmp\", \"cal\", \"cals\", \"csv\", \"cur\", \"cut\", \"dcim\", \"dcm\", \"dcx\", \"dgn\", \"dib\", \"dicm\", \"dicom\", \"doc\", \"docm\", \"docx\", \"dot\", \"dotm\", \"dotx\", \"dwf\", \"dwg\", \"dxf\", \"eml\", \"emz\", \"fodg\", \"fodp\", \"fods\", \"fodt\", \"gif\", \"htm\", \"html\", \"ico\", \"img\", \"jp2\", \"jpc\", \"jpeg\", \"jpg\", \"jpx\", \"msg\", \"ncr\", \"odg\", \"odp\", \"ods\", \"odt\", \"otg\", \"otp\", \"ots\", \"ott\", \"pbm\", \"pcd\", \"pct\", \"pcx\", \"pdf\", \"pgm\", \"pic\", \"pict\", \"png\", \"pot\", \"potm\", \"potx\", \"ppm\", \"pps\", \"ppsm\", \"ppsx\", \"ppt\", \"pptm\", \"pptx\", \"psb\", \"psd\", \"ras\", \"rtf\", \"sct\", \"sgi\", \"tga\", \"tif\", \"tiff\", \"tpic\", \"txt\", \"vdx\", \"vsd\", \"vsdm\", \"vsdx\", \"wbmp\", \"wmf\", \"wmz\", \"wpg\", \"xbm\", \"xhtml\", \"xls\", \"xlsm\", \"xlsx\", \"xlt\", \"xltm\", \"xltx\", \"xwd\"");
        }
        public async Task Will_throw_an_exception_if_given_a_path_to_a_local_file_which_cannot_be_found()
        {
            AffinitySession affinitySession = Util.RestClient.CreateAffinitySession();
            var             input           = new ConversionSourceDocument("documents/does not exist.pdf");

            Assert.IsNull(input.RemoteWorkFile);

            await UtilAssert.ThrowsExceptionWithMessageAsync <FileNotFoundException>(
                async() => { await input.EnsureUsableRemoteWorkFileAsync(affinitySession); },
                "File not found: \"documents/does not exist.pdf\"");
        }
        public async Task Footer_with_JPEG_output()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync("documents/example.pdf", new DestinationOptions(DestinationFileFormat.Jpeg)
                {
                    Footer = this.exampleHeaderFooterContent
                });
            }, "Remote server does not support applying headers or footers when producing JPEG output.");
        }
Пример #18
0
 public async Task Multiple_to_JPEG()
 {
     await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
         async() =>
     {
         await prizmDocServer.ConvertAsync(
             new List <ConversionSourceDocument>
         {
             new ConversionSourceDocument("documents/example.docx"),
             new ConversionSourceDocument("documents/example.pdf"),
         },
             new DestinationOptions(DestinationFileFormat.Jpeg));
     }, "Remote server does not support combining multiple ConversionSourceDocument instances to JPEG. When converting to JPEG, use a single ConversionSourceDocument.");
 }
Пример #19
0
        public async Task PNG_bad_MaxWidth()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync("documents/example.pdf", new DestinationOptions(DestinationFileFormat.Png)
                {
                    PngOptions = new PngDestinationOptions {
                        MaxWidth = "wat"
                    },
                });
            }, $"Invalid PngOptions.MaxWidth for remote server: \"wat\". Try using a CSS-style string, like \"800px\".");
        }
Пример #20
0
        public async Task When_work_file_does_not_exist()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            AffinitySession affinitySession = Util.RestClient.CreateAffinitySession();
            RemoteWorkFile  validWorkFile   = await affinitySession.UploadAsync("documents/confidential-contacts.pdf");

            RemoteWorkFile invalidWorkFile = new RemoteWorkFile(affinitySession, "non-existent-id", validWorkFile.AffinityToken, "pdf");

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.CreateRedactionsAsync(invalidWorkFile, new[] { new RegexRedactionMatchRule("dummy rule") });
            }, "Could not use the given RemoteWorkFile as the source document: the work file resource could not be found on the remote server. It may have expired.");
        }
Пример #21
0
        public async Task TIFF_bad_MaxHeight()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync("documents/example.pdf", new DestinationOptions(DestinationFileFormat.Tiff)
                {
                    TiffOptions = new TiffDestinationOptions {
                        MaxHeight = "wat"
                    },
                });
            }, $"Invalid TiffOptions.MaxHeight for remote server: \"wat\". Try using a CSS-style string, like \"600px\".");
        }
Пример #22
0
        public async Task BurnMarkupAsync_fails_with_a_useful_error_message_when_the_source_document_cannot_be_found()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            AffinitySession affinitySession    = Util.RestClient.CreateAffinitySession();
            RemoteWorkFile  existingMarkupFile = await affinitySession.UploadAsync("documents/confidential-contacts.pdf.markup.json");

            RemoteWorkFile nonExistentSourceDocument = new RemoteWorkFile(affinitySession, "non-existent-id", existingMarkupFile.AffinityToken, "pdf");

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.BurnMarkupAsync(nonExistentSourceDocument, existingMarkupFile);
            }, "Could not use the given RemoteWorkFile as the source document: the work file resource could not be found on the remote server. It may have expired.");
        }
        public async Task When_attempting_to_convert_only_page_1_to_PNG()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            // In this case, the REST API actually returns 200 and begins the
            // conversion. However, it does not actually honor the source "pages"
            // value. To avoid a breaking change for the SDK consumer, the SDK ensures
            // that the "pages" value was not ignored. If it was, it throws this
            // artificial error, preventing the caller from getting unexpected
            // results.
            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(new ConversionSourceDocument("documents/example.docx", pages: "1"), DestinationFileFormat.Png);
            }, $"Remote server does not support taking only specific pages of a source document when the destination type is PNG.");
        }
Пример #24
0
        public async Task Footer_with_TIFF_output_with_force_one_file_per_page()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync("documents/example.pdf", new DestinationOptions(DestinationFileFormat.Tiff)
                {
                    TiffOptions = new TiffDestinationOptions {
                        ForceOneFilePerPage = true
                    },
                    Footer = this.exampleHeaderFooterContent,
                });
            }, "Remote server does not support applying headers or footers when TiffOptions.ForceOneFilePerPage is set to true.");
        }
        public async Task Unexpected_200_with_errorCode_on_GET()
        {
            mockServer
            .Given(Request.Create().WithPath("/PCCIS/V1/MarkupBurner/fake-process-id").UsingGet())
            .RespondWith(Response.Create()
                         .WithStatusCode(200)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"processId\":\"fake-process-id\",\"expirationDateTime\":\"2020-01-06T16:50:45.637Z\",\"input\":{\"documentFileId\":\"fake-file-id\",\"markupFileId\":\"fake-file-id\"},\"state\":\"error\",\"percentComplete\":100,\"errorCode\":\"ServerOnFire\",\"errorDetails\":{\"temperature\":999}}"));

            string expectedMessage = @"Remote server returned an error: ServerOnFire {
  ""temperature"": 999
}";

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() => { await prizmDocServer.BurnMarkupAsync("documents/confidential-contacts.pdf", "documents/confidential-contacts.pdf.markup.json"); },
                expectedMessage);
        }
        public async Task When_the_product_is_not_licensed()
        {
            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"errorCode\":\"LicenseCouldNotBeVerified\"}"));

            var dummyInput = new ConversionSourceDocument(new RemoteWorkFile(null, null, null, null));

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(dummyInput, new DestinationOptions(DestinationFileFormat.Pdf));
            }, "Remote server does not have a valid license.");
        }
        public async Task When_the_password_protected_source_document_is_one_of_several_source_documents_and_no_password_is_given()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(
                    new List <ConversionSourceDocument>
                {
                    new ConversionSourceDocument("documents/example.pdf"),
                    new ConversionSourceDocument("documents/password.docx"),
                    new ConversionSourceDocument("documents/example.pdf"),
                },
                    new DestinationOptions(DestinationFileFormat.Pdf));
            }, "Password required for ConversionSourceDocument at index 1 (\"documents/password.docx\").");
        }
        public async Task Unexpected_480_with_errorCode_on_POST()
        {
            mockServer
            .Given(Request.Create().WithPath("/PCCIS/V1/MarkupBurner").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"errorCode\":\"ServerOnFire\",\"errorDetails\":{\"in\":\"body\",\"at\":\"input.admin.enableTurboMode\"}}"));

            string expectedMessage = @"Remote server returned an error: ServerOnFire {
  ""in"": ""body"",
  ""at"": ""input.admin.enableTurboMode""
}";

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() => { await prizmDocServer.BurnMarkupAsync("documents/confidential-contacts.pdf", "documents/confidential-contacts.pdf.markup.json"); },
                expectedMessage);
        }
        public async Task When_single_input_work_file_does_not_exist()
        {
            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"input\":{\"dest\":{\"format\":\"pdf\",\"pdfOptions\":{\"forceOneFilePerPage\":false}},\"sources\":[{\"fileId\":\"ML3AbF-qzIH5K9mVVxTlBX\",\"pages\":\"\"}]},\"minSecondsAvailable\":18000,\"errorCode\":\"WorkFileDoesNotExist\",\"errorDetails\":{\"in\":\"body\",\"at\":\"input.sources[0].fileId\"}}"));

            var originalRemoteWorkFile  = new RemoteWorkFile(null, "ML3AbF-qzIH5K9mVVxTlBX", "FCnaLL517YPRAnrcX2wlnKURpNPsp2d2pMPkcvCcpdY=", "docx");
            var originalConversionInput = new ConversionSourceDocument(originalRemoteWorkFile);

            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(originalConversionInput, new DestinationOptions(DestinationFileFormat.Pdf));
            }, "ConversionSourceDocument refers to a remote work file which does not exist. It may have expired.");
        }
        public async Task When_using_a_single_source_input()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();

            // This assertion is coupled to what is currently supported in the product. It would be better if we used a mock for this test.
            await UtilAssert.ThrowsExceptionWithMessageAsync <RestApiErrorException>(
                async() =>
            {
                await prizmDocServer.ConvertAsync(new ConversionSourceDocument("documents/example.docx"), new DestinationOptions(DestinationFileFormat.Pdf)
                {
                    PdfOptions = new PdfDestinationOptions()
                    {
                        Ocr = new OcrOptions()
                        {
                            Language = "english",
                        },
                    },
                });
            }, "Unsupported file format when performing OCR, \"docx\". The remote server only supports the following input file formats when performing OCR: \"bmp\", \"cal\", \"cals\", \"cur\", \"cut\", \"dcim\", \"dcm\", \"dcx\", \"dib\", \"dicm\", \"dicom\", \"emz\", \"gif\", \"ico\", \"img\", \"jp2\", \"jpc\", \"jpeg\", \"jpg\", \"jpx\", \"ncr\", \"pbm\", \"pcd\", \"pct\", \"pcx\", \"pdf\", \"pgm\", \"pic\", \"pict\", \"png\", \"ppm\", \"psb\", \"psd\", \"ras\", \"sct\", \"sgi\", \"tga\", \"tif\", \"tiff\", \"tpic\", \"wbmp\", \"wmz\", \"wpg\", \"xbm\", \"xwd\"");
        }