Esempio n. 1
0
        public void UnitTests_Fax_DownloadFax_WithOptions()
        {
            Action <IRestRequest> requestAsserts = req =>
            {
                var parameters = ParametersHelper.ToDictionary(req.Parameters);

                Assert.AreEqual(parameters["id"], "1234");
                Assert.AreEqual(parameters["type"], "l");
            };

            var clientBuilder = new IRestClientBuilder {
                Op = "faxFile", RequestAsserts = requestAsserts
            };

            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.BuildUntyped());

            var testPdf = BinaryFixtures.getTestPdfFile();

            var pdfBytes = phaxio.DownloadFax("1234", "l");

            Assert.IsNotEmpty(pdfBytes);

            var expectedPdf = BinaryFixtures.GetTestPdf();

            Assert.AreEqual(expectedPdf, pdfBytes, "PDFs should be the same.");
        }
Esempio n. 2
0
        public void UnitTests_GetHostedDocument_WithMetadata()
        {
            var metadata = "key";
            var filename = "hostedoc.pdf";

            Action <IRestRequest> requestAsserts = req =>
            {
                var parameters = ParametersHelper.ToDictionary(req.Parameters);

                Assert.AreEqual(parameters["name"], filename);
                Assert.AreEqual(parameters["metadata"], metadata);
            };

            var clientBuilder = new IRestClientBuilder {
                Op = "getHostedDocument", RequestAsserts = requestAsserts
            };

            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.BuildUntyped());

            var testPdf = BinaryFixtures.getTestPdfFile();

            var pdfBytes = phaxio.GetHostedDocument(filename, metadata: metadata);

            Assert.IsNotEmpty(pdfBytes);

            var expectedPdf = BinaryFixtures.GetTestPdf();

            Assert.AreEqual(expectedPdf, pdfBytes, "PDFs should be the same.");
        }