public void HtmlGetInfoReturnsFileNotFoundTest()
        {
            var request = new HtmlGetDocumentInfoRequest
            {
                FileName          = "file-not-found.docx",
                Password          = null,
                RenderComments    = null,
                RenderHiddenPages = null,
                Folder            = null,
                Storage           = null,
            };

            var ex = Assert.Throws <ApiException>(() =>
            {
                ViewerApi.HtmlGetDocumentInfo(request);
            });

            Assert.AreEqual("Can't find file with given name 'file-not-found.docx' and folder ''.", ex.Message);
        }
        public void HtmlGetInfoWithRenderHiddenPagesTest()
        {
            var file = TestFiles.TwoHiddenPagesVsd;

            var request = new HtmlGetDocumentInfoRequest
            {
                FileName          = file.FileName,
                Password          = null,
                RenderComments    = null,
                RenderHiddenPages = true,
                Folder            = file.Folder,
                Storage           = null,
            };

            var response = ViewerApi.HtmlGetDocumentInfo(request);

            Assert.AreEqual("two-hidden-pages.vsd", response.FileName);
            Assert.AreEqual(".vsd", response.Extension);
            Assert.AreEqual(3, response.Pages.Count);
        }
        public void HtmlGetInfoTest()
        {
            var file = TestFiles.FourPagesDocx;

            var request = new HtmlGetDocumentInfoRequest
            {
                FileName          = file.FileName,
                Password          = null,
                RenderComments    = null,
                RenderHiddenPages = null,
                Folder            = file.Folder,
                Storage           = null,
            };

            var response = ViewerApi.HtmlGetDocumentInfo(request);

            Assert.AreEqual("four-pages.docx", response.FileName);
            Assert.AreEqual(".docx", response.Extension);
            Assert.AreEqual(4, response.Pages.Count);
        }
        public void HtmlGetInfoReturnsPasswordNotProvidedTest()
        {
            var file = TestFiles.PasswordProtectedDocx;

            var request = new HtmlGetDocumentInfoRequest
            {
                FileName          = file.FileName,
                Password          = null,
                RenderComments    = null,
                RenderHiddenPages = null,
                Folder            = file.Folder,
                Storage           = null,
            };

            var ex = Assert.Throws <ApiException>(() =>
            {
                ViewerApi.HtmlGetDocumentInfo(request);
            });

            Assert.AreEqual("The password was not provided. The specified file 'password-protected.docx' is password-protected.", ex.Message);
        }
        public void HtmlGetInfoReturnsFailedToReadFileTest()
        {
            var file = TestFiles.CorruptedPdf;

            var request = new HtmlGetDocumentInfoRequest
            {
                FileName          = file.FileName,
                Password          = null,
                RenderComments    = null,
                RenderHiddenPages = null,
                Folder            = file.Folder,
                Storage           = null,
            };

            var ex = Assert.Throws <ApiException>(() =>
            {
                ViewerApi.HtmlGetDocumentInfo(request);
            });

            Assert.AreEqual("Failed to read specified file 'corrupted.pdf'. File can be corrupted or damaged.", ex.Message);
        }
        public void HtmlGetInfoReturnsInvalidPasswordTest()
        {
            var file = TestFiles.PasswordProtectedDocx;

            var request = new HtmlGetDocumentInfoRequest
            {
                FileName          = file.FileName,
                Password          = "******",
                RenderComments    = null,
                RenderHiddenPages = null,
                Folder            = file.Folder,
                Storage           = null,
            };

            var ex = Assert.Throws <ApiException>(() =>
            {
                ViewerApi.HtmlGetDocumentInfo(request);
            });

            Assert.AreEqual("Password provided for file with name 'password-protected.docx' is incorrect.", ex.Message);
        }