|
| 1 | +/* |
| 2 | + * Web API Swagger specification |
| 3 | + * |
| 4 | + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) |
| 5 | + * |
| 6 | + * OpenAPI spec version: 1.0 |
| 7 | + * |
| 8 | + * Generated by: https://github.com/swagger-api/swagger-codegen.git |
| 9 | + */ |
| 10 | + |
| 11 | +using System; |
| 12 | +using System.IO; |
| 13 | +using System.Collections.Generic; |
| 14 | +using System.Collections.ObjectModel; |
| 15 | +using System.Linq; |
| 16 | +using System.Reflection; |
| 17 | +using RestSharp; |
| 18 | +using NUnit.Framework; |
| 19 | + |
| 20 | +using Aspose.Cells.Cloud.SDK.Client; |
| 21 | +using Aspose.Cells.Cloud.SDK.Api; |
| 22 | +using Aspose.Cells.Cloud.SDK.Model; |
| 23 | +using System.Net; |
| 24 | + |
| 25 | +namespace Aspose.Cells.Cloud.SDK.Test |
| 26 | +{ |
| 27 | + /// <summary> |
| 28 | + /// Class for testing CellsSaveAsApi |
| 29 | + /// </summary> |
| 30 | + /// <remarks> |
| 31 | + /// This file is automatically generated by Swagger Codegen. |
| 32 | + /// Please update the test case below to test the API endpoint. |
| 33 | + /// </remarks> |
| 34 | + [TestFixture] |
| 35 | + public class CellsBatchApiTests : CellsBaseTest |
| 36 | + { |
| 37 | + private CellsApi instance; |
| 38 | + /// <summary> |
| 39 | + /// Setup before each unit test |
| 40 | + /// </summary> |
| 41 | + [SetUp] |
| 42 | + public void Init() |
| 43 | + { |
| 44 | + instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl); |
| 45 | + } |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// Clean up after each unit test |
| 49 | + /// </summary> |
| 50 | + [TearDown] |
| 51 | + public void Cleanup() |
| 52 | + { |
| 53 | + |
| 54 | + } |
| 55 | + |
| 56 | + |
| 57 | + /// <summary> |
| 58 | + /// Test CellsSaveAsPostDocumentSaveAs |
| 59 | + /// </summary> |
| 60 | + [TestCase("pdf")] |
| 61 | + [TestCase("png")] |
| 62 | + [TestCase("emf")] |
| 63 | + [TestCase("tiff")] |
| 64 | + [TestCase("docx")] |
| 65 | + [TestCase("svg")] |
| 66 | + public void CellsBatchApiTests_Convert(string format) |
| 67 | + { |
| 68 | + // TODO uncomment below to test the method and replace null with proper value |
| 69 | + if( instance.ObjectExists(OutPut).Exists.Value) |
| 70 | + { |
| 71 | + instance.DeleteFolder(OutPut,null,true); |
| 72 | + } |
| 73 | + instance.CreateFolder(OutPut); |
| 74 | + if (instance.ObjectExists(BatchFolder).Exists.Value) |
| 75 | + { |
| 76 | + instance.DeleteFolder(BatchFolder, null, true); |
| 77 | + } |
| 78 | + instance.CreateFolder(BatchFolder); |
| 79 | + UpdateDataFile(instance, BatchFolder, BOOK1); |
| 80 | + UpdateDataFile(instance, BatchFolder, MYDOC); |
| 81 | + UpdateDataFile(instance, BatchFolder, DataSource); |
| 82 | + UpdateDataFile(instance, BatchFolder, AssemblyTest); |
| 83 | + |
| 84 | + BatchConvertRequest batchConvertRequest = new BatchConvertRequest(); |
| 85 | + batchConvertRequest.Format = format; |
| 86 | + batchConvertRequest.MatchCondition = new MatchConditionRequest(); |
| 87 | + batchConvertRequest.MatchCondition.FullMatchConditions = new List<string> {"Book1.xlsx", "myDocument.xlsx" }; |
| 88 | + batchConvertRequest.SourceFolder = BatchFolder; |
| 89 | + var response = instance.PostBatchConvert(batchConvertRequest); |
| 90 | + Assert.IsInstanceOf<Stream>(response, "response is CellsCloudResponse"); |
| 91 | + Download(response, "CellsBatchApiTests_Convert_"+format+".zip"); |
| 92 | + |
| 93 | + } |
| 94 | + /// <summary> |
| 95 | + /// Test CellsSaveAsPostDocumentSaveAs |
| 96 | + /// </summary> |
| 97 | + [TestCase("pdf")] |
| 98 | + [TestCase("png")] |
| 99 | + [TestCase("emf")] |
| 100 | + [TestCase("tiff")] |
| 101 | + [TestCase("docx")] |
| 102 | + [TestCase("svg")] |
| 103 | + public void CellsBatchApiTests_Convert_outfolser(string format) |
| 104 | + { |
| 105 | + // TODO uncomment below to test the method and replace null with proper value |
| 106 | + if (instance.ObjectExists(OutPut).Exists.Value) |
| 107 | + { |
| 108 | + instance.DeleteFolder(OutPut, null, true); |
| 109 | + } |
| 110 | + instance.CreateFolder(OutPut); |
| 111 | + if (instance.ObjectExists(BatchFolder).Exists.Value) |
| 112 | + { |
| 113 | + instance.DeleteFolder(BatchFolder, null, true); |
| 114 | + } |
| 115 | + instance.CreateFolder(BatchFolder); |
| 116 | + UpdateDataFile(instance, BatchFolder, BOOK1); |
| 117 | + UpdateDataFile(instance, BatchFolder, MYDOC); |
| 118 | + UpdateDataFile(instance, BatchFolder, DataSource); |
| 119 | + UpdateDataFile(instance, BatchFolder, AssemblyTest); |
| 120 | + |
| 121 | + BatchConvertRequest batchConvertRequest = new BatchConvertRequest(); |
| 122 | + batchConvertRequest.Format = format; |
| 123 | + batchConvertRequest.MatchCondition = new MatchConditionRequest(); |
| 124 | + batchConvertRequest.MatchCondition.FullMatchConditions = new List<string> { "Book1.xlsx", "myDocument.xlsx" }; |
| 125 | + batchConvertRequest.SourceFolder = BatchFolder; |
| 126 | + batchConvertRequest.OutFolder = OutPut; |
| 127 | + var response = instance.PostBatchConvert(batchConvertRequest); |
| 128 | + Assert.IsInstanceOf<Stream>(response, "response is CellsCloudResponse"); |
| 129 | + DTO.CellsCloudResponse cellsCloudResponse = ToCellsCloudResponse(response); |
| 130 | + Assert.AreEqual(cellsCloudResponse.Code, HttpStatusCode.OK); |
| 131 | + |
| 132 | + } |
| 133 | + |
| 134 | + } |
| 135 | + |
| 136 | +} |
0 commit comments