예제 #1
0
        public void TestGetSections()
        {
            var localName  = "test_multi_pages.docx";
            var remoteName = "TestGetSections.docx";
            var fullName   = Path.Combine(this.dataFolder, remoteName);

            this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName));

            var request = new GetSectionsRequest(remoteName, this.dataFolder);
            var actual  = this.WordsApi.GetSections(request);

            Assert.AreEqual(200, actual.Code);
        }
예제 #2
0
        public void TestHandleErrors()
        {
            string name = "noFileWithThisName.docx";

            try
            {
                var request = new GetSectionsRequest(name);
                this.WordsApi.GetSections(request);

                Assert.Fail("Excpected exception has not been throwed");
            }
            catch (ApiException apiException)
            {
                Assert.AreEqual(400, apiException.ErrorCode);
                Assert.IsTrue(apiException.Message.StartsWith("Error while loading file 'noFileWithThisName.docx' from storage:"), "Current message: " + apiException.Message);
            }
        }
        public void TestGetSections()
        {
            string remoteFileName = "TestGetSections.docx";

            this.UploadFileToStorage(
                remoteDataFolder + "/" + remoteFileName,
                null,
                null,
                File.ReadAllBytes(LocalTestDataFolder + localFile)
                );

            var request = new GetSectionsRequest(
                name: remoteFileName,
                folder: remoteDataFolder
                );
            var actual = this.WordsApi.GetSections(request);

            Assert.NotNull(actual.Sections);
            Assert.NotNull(actual.Sections.SectionLinkList);
            Assert.AreEqual(1, actual.Sections.SectionLinkList.Count);
            Assert.AreEqual("0", actual.Sections.SectionLinkList[0].NodeId);
        }