Skip to content

Commit 9625bc2

Browse files
committed
Release Aspose.Cells Cloud SDK 21.10
1 parent 936ff8f commit 9625bc2

File tree

10 files changed

+771
-31
lines changed

10 files changed

+771
-31
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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+
}

Aspose.Cells.Cloud.SDK.Test/Api/CellsWorksheetsApiTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace Aspose.Cells.Cloud.SDK.Test
1313
using NUnit.Framework;
1414
using Aspose.Cells.Cloud.SDK.Api;
1515
using Aspose.Cells.Cloud.SDK.Model;
16+
using System.Collections.Generic;
1617

1718
/// <summary>
1819
/// Class for testing CellsWorksheetsApi
@@ -696,6 +697,24 @@ public void CellsWorksheetsGetWorkSheetForPageIndexTest()
696697
Assert.IsInstanceOf<System.IO.Stream>(response, "response is System.IO.Stream");
697698

698699
}
700+
/// <summary>
701+
/// Test CellsWorksheetsGetWorkSheet
702+
/// </summary>
703+
[Test]
704+
public void CellsWorksheetsDeleteWorkSheetsTest()
705+
{
706+
// TODO uncomment below to test the method and replace null with proper value
707+
MatchConditionRequest matchConditionRequest = new MatchConditionRequest();
708+
matchConditionRequest.FullMatchConditions = new List<string>() { "Sheet1", "Sheet2", "Sheet3" }; ;
709+
var name = BOOK1;
710+
711+
string folder = TEMPFOLDER;
712+
UpdateDataFile(instance, folder, BOOK1);
713+
714+
var response = instance.CellsWorksheetsDeleteWorksheets(name, matchConditionRequest, folder);
715+
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is System.IO.Stream");
716+
717+
}
699718
}
700719

701720
}

Aspose.Cells.Cloud.SDK.Test/CellsBaseTest.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace Aspose.Cells.Cloud.SDK.Test
55
using Aspose.Cells.Cloud.SDK.Api;
66
using System.IO;
77
using System;
8+
using System.Text;
9+
using Newtonsoft.Json;
810

911
public class CellsBaseTest
1012
{
@@ -32,7 +34,9 @@ protected string clientSecret
3234
protected string MYDOC = "myDocument.xlsx";
3335
protected string PivTestFile = "TestCase.xlsx";
3436
protected string PivTestFile2 = "PivTestFile2.xlsx";
35-
protected string TEMPFOLDER = "DotnetTest";
37+
protected string TEMPFOLDER = "DotNetTest";
38+
protected string BatchFolder = "BatchFiles";
39+
protected string OutPut = "OutPut";
3640
protected string NEEDUNLOCK = "needUnlock.xlsx";
3741
protected string SHEET1 = "Sheet1";
3842
protected string SHEET2 = "Sheet2";
@@ -49,7 +53,7 @@ protected bool IsDockerTest
4953
{
5054
get { return Convert.ToBoolean( Environment.GetEnvironmentVariable("CellsCloudTestIsDockerTest")); }
5155
}
52-
56+
protected const string DownloadFolder = @"C:\data\";
5357
private string TestDataFolder
5458
{
5559
get
@@ -116,6 +120,27 @@ protected void WriteResponseStream(string filename, Stream stream)
116120
stream.CopyTo(fs);
117121
fs.Close();
118122
}
119-
123+
protected bool Download(Stream stream, string filename)
124+
{
125+
if ( Directory.Exists(DownloadFolder))
126+
{
127+
using (FileStream fileStream = File.Create(DownloadFolder + filename))
128+
{
129+
fileStream.Position = 0;
130+
stream.CopyTo(fileStream);
131+
fileStream.Close();
132+
}
133+
}
134+
return true;
135+
}
136+
protected DTO.CellsCloudResponse ToCellsCloudResponse(Stream stream)
137+
{
138+
stream.Position = 0;
139+
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
140+
{
141+
string dto = reader.ReadToEnd();
142+
return JsonConvert.DeserializeObject<DTO.CellsCloudResponse>(dto);
143+
}
144+
}
120145
}
121146
}

0 commit comments

Comments
 (0)