public static void Run(ViewOptions.ViewFormatEnum format) { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new ViewApi(configuration); try { var viewOptions = new ViewOptions() { FileInfo = new FileInfo() { FilePath = "viewerdocs/one-page.docx", Password = "", StorageName = Common.MyStorage }, ViewFormat = format }; var request = new CreateViewRequest(viewOptions); var response = apiInstance.CreateView(request); Console.WriteLine("Expected response type is ViewResult: " + response.Pages.Count.ToString()); } catch (Exception e) { Console.WriteLine("Exception while calling ViewApi: " + e.Message); } }
public void TestCreateViewWithImageViewFormat(ViewOptions.ViewFormatEnum format) { // Arrange var testFile = TestFiles.OnePageDocx; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo(), ViewFormat = format }; var request = new CreateViewRequest(viewOptions); // Act & Assert var viewResult = ViewApi.CreateView(request); Assert.AreEqual(1, viewResult.Pages.Count); Assert.AreEqual(0, viewResult.Attachments.Count); var page = viewResult.Pages[0]; Assert.AreEqual(1, page.Number); }
public void TestGetInfoWithImageViewFormat(ViewOptions.ViewFormatEnum format) { // Arrange var testFile = TestFiles.OnePageDocx; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo(), ViewFormat = format }; var request = new GetInfoRequest(viewOptions); // Act & Assert var infoResult = InfoApi.GetInfo(request); Assert.AreEqual(1, infoResult.Pages.Count); Assert.AreEqual(0, infoResult.Attachments.Count); var page = infoResult.Pages[0]; Assert.AreEqual(1, page.Number); Assert.Greater(page.Width, 0); }