public void IfUserSetDebugOptionRequestAndErrorsShouldBeWritedToTrace() { var localName = "test_multi_pages.docx"; var remoteName = "IfUserSetDebugOptionRequestAndErrorsShouldBeWritedToTrace.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var request = new DeleteFieldsRequest(remoteName, this.dataFolder); var api = new WordsApi(new Configuration { ApiBaseUrl = BaseProductUri, AppKey = AppKey, AppSid = AppSID, DebugMode = true }); var mockFactory = new MockFactory(); var traceListenerMock = mockFactory.CreateMock <TraceListener>(); Trace.Listeners.Add(traceListenerMock.MockObject); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("DELETE: http://api-dev.aspose.cloud/v1.1/words/IfUserSetDebugOptionRequestAndErrorsShouldBeWritedToTrace.docx/fields")); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("Response 200: OK")); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("{\"Code\":200,\"Status\":\"OK\"}")); traceListenerMock.Expects.AtLeastOne.Method(p => p.WriteLine(string.Empty)).With(Is.Anything); // Act api.DeleteFields(request); // Assert mockFactory.VerifyAllExpectationsHaveBeenMet(); }
public void TestPutComment() { var localName = "test_multi_pages.docx"; var remoteName = "TestPutComment.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var nodeLink = new NodeLink { NodeId = "0.0.3" }; var documentPosition = new DocumentPosition { Node = nodeLink, Offset = 0 }; var body = new Comment { RangeStart = documentPosition, RangeEnd = documentPosition, Initial = "IA", Author = "Imran Anwar", Text = "A new Comment" }; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new PutCommentRequest(remoteName, body, this.dataFolder); var actual = this.WordsApi.PutComment(request); Assert.AreEqual(200, actual.Code); }
public void IfUserSetDebugOptionRequestAndErrorsShouldBeWritedToTrace() { var localName = "sample.avi"; var remoteName = "TestPostAppendVideo.avi"; var fullName = Path.Combine(this.dataFolder, remoteName); var fullNameToAppend = Path.Combine(this.dataFolder, "videoForAppend.mp4"); var destFileName = Path.Combine(BaseTestOutPath, remoteName); AppendOptions options = new AppendOptions(); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName)); this.StorageApi.PutCreate(fullNameToAppend, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + "sample.mp4")); options.VideoToAppendPath = fullNameToAppend; var request = new PostAppendVideoRequest(remoteName, destFileName, options, this.dataFolder); var api = this.GetDebugApi(); var mockFactory = new MockFactory(); var traceListenerMock = mockFactory.CreateMock <TraceListener>(); Trace.Listeners.Add(traceListenerMock.MockObject); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("POST: http://api-dev.aspose.cloud/v1.1/video/TestPostAppendVideo.avi")); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("Response 200: OK")); traceListenerMock.Expects.AtLeastOne.Method(p => p.WriteLine(string.Empty)).With(Is.Anything); // Act api.PostAppendVideo(request); // Assert mockFactory.VerifyAllExpectationsHaveBeenMet(); }
public void TestPostAppendDocument() { var localName = "test_multi_pages.docx"; var remoteName = "TestPostAppendDocument.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var destFileName = Path.Combine(BaseTestOutPath, remoteName); var body = new DocumentEntryList(); System.Collections.Generic.List <DocumentEntry> docEntries = new System.Collections.Generic.List <DocumentEntry>(); DocumentEntry docEntry = new DocumentEntry { Href = fullName, ImportFormatMode = "KeepSourceFormatting" }; docEntries.Add(docEntry); body.DocumentEntries = docEntries; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new PostAppendDocumentRequest(remoteName, body, this.dataFolder, destFileName: destFileName); var actual = this.WordsApi.PostAppendDocument(request); Assert.AreEqual(200, actual.Code); }
public void TestUpdateTableProperties() { var localName = "TablesGet.docx"; var remoteName = "TestUpdateTableProperties.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var newProperties = new TableProperties { Alignment = TableProperties.AlignmentEnum.Right, AllowAutoFit = false, Bidi = true, BottomPadding = 1, CellSpacing = 2, LeftIndent = 3, LeftPadding = 4, RightPadding = 5, StyleOptions = TableProperties.StyleOptionsEnum.ColumnBands, TopPadding = 6 }; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.tableFolder) + localName)); var request = new UpdateTablePropertiesRequest(remoteName, 1, this.dataFolder, properties: newProperties); var actual = this.WordsApi.UpdateTableProperties(request); Assert.AreEqual(200, actual.Code); }
public void TestPutFormField() { var localName = "test_multi_pages.docx"; var remoteName = "TestPutFormField.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var destFileName = Path.Combine(BaseTestOutPath, remoteName); var body = new FormFieldTextInput { Name = "FullName", Enabled = true, CalculateOnExit = true, StatusText = string.Empty, TextInputType = FormFieldTextInput.TextInputTypeEnum.Regular, TextInputDefault = "123", TextInputFormat = "UPPERCASE" }; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new PutFormFieldRequest(remoteName, body, this.dataFolder, nodePath: "sections/0/paragraphs/0", destFileName: destFileName); var actual = this.WordsApi.PutFormField(request); Assert.AreEqual(200, actual.Code); }
public void TestPutDocumentFieldNames() { using (var fileStream = File.OpenRead(BaseTestContext.GetDataDir(this.mailMergeFolder) + "SampleExecuteTemplate.docx")) { var request = new PutDocumentFieldNamesRequest(fileStream, true); FieldNamesResponse actual = this.WordsApi.PutDocumentFieldNames(request); Assert.AreEqual(200, actual.Code); } }
public void TestPutConvertDocument() { var format = "pdf"; using (var fileStream = File.OpenRead(BaseTestContext.GetDataDir(this.convertFolder) + "test_uploadfile.docx")) { var request = new PutConvertDocumentRequest(fileStream, format); var result = this.WordsApi.PutConvertDocument(request); Assert.IsTrue(result.Length > 0, "Error occured while converting document"); } }
public void TestClassifyRequestBody() { var localName = "test_multi_pages.docx"; using (var content = File.OpenRead(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)) { // Classifies file with sentiment taxonomy and returns 2 best results. var actual = this.ClassificationApi.ClassifyFile(new ClassifyFileRequest(content, "2", "Sentiment")); Assert.AreEqual(200, actual.Code); } }
public void TestGetDocumentBookmarks() { var localName = "test_multi_pages.docx"; var remoteName = "[“Test_Two,_Inc.”]-_83(b)Election([“Bill_Gates”]).docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.UploadFileToStorage(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new GetBookmarksRequest(remoteName, this.dataFolder); var actual = this.WordsApi.GetBookmarks(request); }
public void TestPutExecuteTemplateOnline() { using (var file = File.OpenRead(BaseTestContext.GetDataDir(this.mailMergeFolder) + "SampleMailMergeTemplate.docx")) { using (var data = File.OpenRead(BaseTestContext.GetDataDir(this.mailMergeFolder) + "SampleExecuteTemplateData.txt")) { var request = new PutExecuteTemplateOnlineRequest(file, data); var result = this.WordsApi.PutExecuteTemplateOnline(request); Assert.IsTrue(result.Length > 0, "Error occured while executing template"); } } }
public void TestPostExtractVideo() { var localName = "sample.mp4"; var resultPath = Path.Combine(this.dataFolder, "extracted.mp4"); var fullName = Path.Combine(this.dataFolder, localName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName)); var request = new PostExtractVideoRequest(localName, resultPath, 1000, 4000, this.dataFolder); var actual = this.VideoApi.PostExtractVideo(request); Assert.AreEqual(200, System.Convert.ToInt32(actual.Code.ToString())); }
public void TestDeleteTableBorders() { var localName = "TablesGet.docx"; var remoteName = "TestDeleteTableBorders.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.tableFolder) + localName)); var request = new DeleteBordersRequest(remoteName, "tables/1/rows/0/cells/0/", this.dataFolder); var actual = this.WordsApi.DeleteBorders(request); Assert.AreEqual(200, actual.Code); }
public void TestGetTableCellFormat() { var localName = "TablesGet.docx"; var remoteName = "TestGetTableCellFormat.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.tableFolder) + localName)); var request = new GetTableCellFormatRequest(remoteName, "sections/0/tables/2/rows/0", 0, this.dataFolder); var actual = this.WordsApi.GetTableCellFormat(request); Assert.AreEqual(200, actual.Code); }
public void TestGetFields() { var localName = "GetField.docx"; var remoteName = "TestGetFields.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.fieldFolder) + localName)); var request = new GetFieldsRequest(remoteName, this.dataFolder, nodePath: "sections/0"); FieldsResponse actual = this.WordsApi.GetFields(request); Assert.AreEqual(200, actual.Code); }
public void TestRenderParagraph() { var localName = "test_multi_pages.docx"; var remoteName = "TestRenderParagraph.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new RenderParagraphRequest(remoteName, "png", 0, this.dataFolder); var actual = this.WordsApi.RenderParagraph(request); Assert.IsTrue(actual.Length > 0, "Error has occured while paragraph rendering"); }
public void TestDeleteSectionParagraphFields() { var localName = "test_multi_pages.docx"; var remoteName = "TestDeleteSectionParagraphFields.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new DeleteFieldsRequest(remoteName, this.dataFolder, nodePath: "sections/0/paragraphs/0"); var actual = this.WordsApi.DeleteFields(request); Assert.AreEqual(200, actual.Code); }
public void TestPostUpdateDocumentFields() { var localName = "test_multi_pages.docx"; var remoteName = "TestPostUpdateDocumentFields.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new PostUpdateDocumentFieldsRequest(remoteName, this.dataFolder); var actual = this.WordsApi.PostUpdateDocumentFields(request); Assert.AreEqual(200, actual.Code); }
public void TestRenderTable() { var localName = "TablesGet.docx"; var remoteName = "TestRenderTable.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.tableFolder) + localName)); var request = new RenderTableRequest(remoteName, "png", 0, this.dataFolder); var actual = this.WordsApi.RenderTable(request); Assert.IsTrue(actual.Length > 0, "Error has occured while table rendering"); }
public void TestGetVideoProperties() { var localName = "sample.avi"; var remoteName = "TestGetVideo.avi"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName)); var request = new GetVideoPropertiesRequest(remoteName, this.dataFolder); var actual = this.VideoApi.GetVideoProperties(request); Assert.AreEqual(200, System.Convert.ToInt32(actual.Code.ToString())); Assert.IsNotNull(actual.VideoProperties.List); }
public void TestGetHeadersFooters() { var localName = "HeadersFooters.doc"; var remoteName = "TestGetHeadersFooters.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.headerFooterFolder) + localName)); var request = new GetHeaderFootersRequest(remoteName, this.dataFolder); var actual = this.WordsApi.GetHeaderFooters(request); Assert.AreEqual(200, actual.Code); }
public void TestGetSectionPageSetup() { var localName = "test_multi_pages.docx"; var remoteName = "TestGetSectionPageSetup.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var sectionIndex = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new GetSectionPageSetupRequest(remoteName, sectionIndex, this.dataFolder); var actual = this.WordsApi.GetSectionPageSetup(request); Assert.AreEqual(200, actual.Code); }
public void TestDeleteField() { var localName = "GetField.docx"; var remoteName = "TestDeleteField.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var fieldIndex = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.fieldFolder) + localName)); var request = new DeleteFieldRequest(remoteName, fieldIndex, this.dataFolder, nodePath: "sections/0/paragraphs/0"); var actual = this.WordsApi.DeleteField(request); Assert.AreEqual(200, actual.Code); }
public void TestGetDocumentDrawingObjectByIndex() { var localName = "test_multi_pages.docx"; var remoteName = "TestGetDocumentDrawingObjectByIndex.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var objectIndex = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new GetDocumentDrawingObjectByIndexRequest(remoteName, objectIndex, this.dataFolder, nodePath: "sections/0"); DrawingObjectResponse actual = this.WordsApi.GetDocumentDrawingObjectByIndex(request); Assert.AreEqual(200, actual.Code); }
public void TestDeleteDrawingObject() { var localName = "test_multi_pages.docx"; var remoteName = "TestDeleteDrawingObject.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); int objectIndex = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new DeleteDrawingObjectRequest(remoteName, objectIndex, this.dataFolder); var actual = this.WordsApi.DeleteDrawingObject(request); Assert.AreEqual(200, actual.Code); }
public void TestGetDocumentDrawingObjectOleData() { var localName = "sample_EmbeddedOLE.docx"; var remoteName = "TestGetDocumentDrawingObjectOleData.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var objectIndex = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.drawingFolder) + localName)); var request = new GetDocumentDrawingObjectOleDataRequest(remoteName, objectIndex, this.dataFolder, nodePath: "sections/0"); var result = this.WordsApi.GetDocumentDrawingObjectOleData(request); Assert.IsTrue(result.Length > 0, "Error occured while getting drawing object"); }
public void TestGetOfficeMathObject() { var localName = "MathObjects.docx"; var remoteName = "TestGetOfficeMathObject.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var index = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.mathObjectFolder) + localName)); var request = new GetOfficeMathObjectRequest(remoteName, index, this.dataFolder); var actual = this.WordsApi.GetOfficeMathObject(request); Assert.AreEqual(200, actual.Code); }
public void TestRenderMathObject() { var localName = "MathObjects.docx"; var remoteName = "TestRenderMathObject.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var index = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.mathObjectFolder) + localName)); var request = new RenderMathObjectRequest(remoteName, "png", index, this.dataFolder); var actual = this.WordsApi.RenderMathObject(request); Assert.IsTrue(actual.Length > 0, "Error has occurred while mathObject rendering"); }
public void TestDeleteRun() { var localName = "Run.doc"; var remoteName = "TestDeleteRun.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var index = 0; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.runFolder) + localName)); var request = new DeleteRunRequest(remoteName, "paragraphs/1", index, this.dataFolder); var actual = this.WordsApi.DeleteRun(request); Assert.AreEqual(200, actual.Code); }
public void TestSearch() { var localName = "SampleWordDocument.docx"; var remoteName = "TestSearch.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var pattern = "aspose"; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.textFolder) + localName)); var request = new SearchRequest(remoteName, pattern, this.dataFolder); var actual = this.WordsApi.Search(request); Assert.AreEqual(200, actual.Code); }