public void TestGetInfo() { // Arrange var request = new GetDocumentInfoRequest(TestFiles.SourceWord.ToFileInfo()); // Act & Assert var infoResult = InfoApi.GetDocumentInfo(request); Assert.AreEqual(1, infoResult.PageCount); }
public void TestGetInfoReturnsFileNotFound() { // Arrange var request = new GetDocumentInfoRequest(TestFiles.NotExist.ToFileInfo()); // Act & Assert var ex = Assert.Throws <ApiException>(() => { InfoApi.GetDocumentInfo(request); }); Assert.AreEqual("Can't find file located at 'some-folder\\NotExist.docx'.", ex.Message); }
public void TestGetInfoReturnsMissingFileInfo() { // Arrange var request = new GetDocumentInfoRequest(); // Act & Assert var ex = Assert.Throws <ApiException>(() => { InfoApi.GetDocumentInfo(request); }); Assert.AreEqual("Missing required parameter 'fileInfo' when calling GetDocumentInfo", ex.Message); }
public static void Run() { var apiInstance = new InfoApi(Constants.GetConfig()); try { var fileInfo = new FileInfo { FilePath = "source_files/word/source.docx" }; var request = new GetDocumentInfoRequest(fileInfo); var response = apiInstance.GetDocumentInfo(request); Console.WriteLine("InfoResult.Pages.Count: " + response.PageCount); } catch (Exception e) { Console.WriteLine("Exception while calling InfoApi: " + e.Message); } }