Skip to content

Commit 86c687b

Browse files
committed
2021112 update : update test case.
1 parent 9625bc2 commit 86c687b

File tree

11 files changed

+879
-104
lines changed

11 files changed

+879
-104
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public void CellsBatchApiTests_Convert_outfolser(string format)
126126
batchConvertRequest.OutFolder = OutPut;
127127
var response = instance.PostBatchConvert(batchConvertRequest);
128128
Assert.IsInstanceOf<Stream>(response, "response is CellsCloudResponse");
129-
DTO.CellsCloudResponse cellsCloudResponse = ToCellsCloudResponse(response);
130-
Assert.AreEqual(cellsCloudResponse.Code, HttpStatusCode.OK);
129+
CellsCloudResponse cellsCloudResponse = ToCellsCloudResponse(response);
130+
Assert.AreEqual(cellsCloudResponse.Code, 200);
131131

132132
}
133133

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,20 @@ public void CellsWorkbookPutWorkbookWatermarkerTest()
632632
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is WorkbookResponse");
633633
Assert.AreEqual(response.Code, 200);
634634
}
635+
636+
[Test]
637+
public void CellsWorkbookGetPageCountTest()
638+
{
639+
// TODO uncomment below to test the method and replace null with proper value
640+
641+
string name = BOOK1;
642+
string folder = TEMPFOLDER;
643+
644+
UpdateDataFile(instance, folder, name);
645+
var response = instance.CellsWorkbookGetPageCount(name, folder);
646+
Assert.IsInstanceOf<long>(response, "response is WorkbookResponse");
647+
Assert.Greater((long)response ,0);
648+
}
635649
}
636650

637651
}

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

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void CellsWorksheetsDeleteWorksheetTest()
124124
string folder = TEMPFOLDER;
125125
UpdateDataFile(instance,folder, name);
126126
var response = instance.CellsWorksheetsDeleteWorksheet(name, sheetName, folder);
127-
Assert.IsInstanceOf<WorksheetsResponse>(response, "response is WorksheetsResponse");
127+
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is WorksheetsResponse");
128128
Assert.AreEqual(response.Code, 200);
129129
}
130130

@@ -415,7 +415,7 @@ public void CellsWorksheetsPostMoveWorksheetTest()
415415
string folder = TEMPFOLDER;
416416
UpdateDataFile(instance,folder, name);
417417
var response = instance.CellsWorksheetsPostMoveWorksheet(name, sheetName, moving, folder);
418-
Assert.IsInstanceOf<WorksheetsResponse>(response, "response is WorksheetsResponse");
418+
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is WorksheetsResponse");
419419
Assert.AreEqual(response.Code, 200);
420420
}
421421

@@ -559,7 +559,7 @@ public void CellsWorksheetsPutAddNewWorksheetTest()
559559
string folder = TEMPFOLDER;
560560
UpdateDataFile(instance,folder, name);
561561
var response = instance.CellsWorksheetsPutAddNewWorksheet(name, sheetName, position, sheettype, folder);
562-
Assert.IsInstanceOf<WorksheetsResponse>(response, "response is WorksheetsResponse");
562+
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is WorksheetsResponse");
563563
Assert.AreEqual(response.Code, 201);
564564
}
565565

@@ -576,7 +576,7 @@ public void CellsWorksheetsPutChangeVisibilityWorksheetTest()
576576
string folder = TEMPFOLDER;
577577
UpdateDataFile(instance,folder, name);
578578
var response = instance.CellsWorksheetsPutChangeVisibilityWorksheet(name, sheetName, isVisible, folder);
579-
Assert.IsInstanceOf<WorksheetResponse>(response, "response is WorksheetResponse");
579+
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is WorksheetResponse");
580580
Assert.AreEqual(response.Code, 200);
581581
}
582582

@@ -715,6 +715,25 @@ public void CellsWorksheetsDeleteWorkSheetsTest()
715715
Assert.IsInstanceOf<CellsCloudResponse>(response, "response is System.IO.Stream");
716716

717717
}
718+
/// <summary>
719+
/// Test CellsWorksheetsGetWorkSheet
720+
/// </summary>
721+
[Test]
722+
public void CellsWorksheetsGetPageCountTest()
723+
{
724+
// TODO uncomment below to test the method and replace null with proper value
725+
MatchConditionRequest matchConditionRequest = new MatchConditionRequest();
726+
matchConditionRequest.FullMatchConditions = new List<string>() { "Sheet1", "Sheet2", "Sheet3" }; ;
727+
var name = BOOK1;
728+
729+
string folder = TEMPFOLDER;
730+
UpdateDataFile(instance, folder, BOOK1);
731+
732+
var response = instance.CellsWorksheetsGetPageCount(name, SHEET1, folder);
733+
Assert.IsInstanceOf<long>(response, "response is WorkbookResponse");
734+
Assert.Greater((long)response, 0);
735+
736+
}
718737
}
719738

720739
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Aspose.Cells.Cloud.SDK.Test
77
using System;
88
using System.Text;
99
using Newtonsoft.Json;
10+
using Aspose.Cells.Cloud.SDK.Model;
1011

1112
public class CellsBaseTest
1213
{
@@ -133,13 +134,13 @@ protected bool Download(Stream stream, string filename)
133134
}
134135
return true;
135136
}
136-
protected DTO.CellsCloudResponse ToCellsCloudResponse(Stream stream)
137+
protected CellsCloudResponse ToCellsCloudResponse(Stream stream)
137138
{
138139
stream.Position = 0;
139140
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
140141
{
141142
string dto = reader.ReadToEnd();
142-
return JsonConvert.DeserializeObject<DTO.CellsCloudResponse>(dto);
143+
return JsonConvert.DeserializeObject<CellsCloudResponse>(dto);
143144
}
144145
}
145146
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
24+
namespace Aspose.Cells.Cloud.SDK.Test.LiteApi
25+
{
26+
/// <summary>
27+
/// Class for testing OAuthApi
28+
/// </summary>
29+
/// <remarks>
30+
/// This file is automatically generated by Swagger Codegen.
31+
/// Please update the test case below to test the API endpoint.
32+
/// </remarks>
33+
[TestFixture]
34+
public class CompressTests : CellsBaseTest
35+
{
36+
private ILiteCellsApi instance;
37+
38+
/// <summary>
39+
/// Setup before each unit test
40+
/// </summary>
41+
[SetUp]
42+
public void Init()
43+
{
44+
instance = new LiteCellsApi(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+
[TestCase(10)]
58+
[TestCase(90)]
59+
public void PostCompressApi_Test(int compressLevel)
60+
{
61+
if(IsDockerTest)
62+
{
63+
Assert.IsTrue(true);
64+
return;
65+
}
66+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
67+
files.Add(BOOK1, GetTestDataStream(BOOK1));
68+
var filesResult = instance.PostCompress(files, compressLevel);
69+
Assert.IsInstanceOf<Model.FilesResult>(filesResult, "response is FilesResult");
70+
}
71+
72+
73+
}
74+
75+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
24+
namespace Aspose.Cells.Cloud.SDK.Test.LiteApi
25+
{
26+
/// <summary>
27+
/// Class for testing OAuthApi
28+
/// </summary>
29+
/// <remarks>
30+
/// This file is automatically generated by Swagger Codegen.
31+
/// Please update the test case below to test the API endpoint.
32+
/// </remarks>
33+
[TestFixture]
34+
public class ReplaceTests : CellsBaseTest
35+
{
36+
private ILiteCellsApi instance;
37+
38+
/// <summary>
39+
/// Setup before each unit test
40+
/// </summary>
41+
[SetUp]
42+
public void Init()
43+
{
44+
instance = new LiteCellsApi(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+
[Test]
57+
public void PostReplaceApi_Test()
58+
{
59+
if(IsDockerTest)
60+
{
61+
Assert.IsTrue(true);
62+
return;
63+
}
64+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
65+
files.Add(BOOK1, GetTestDataStream(BOOK1));
66+
var filesResult = instance.PostReplace(files, "1","replace ok");
67+
Assert.IsInstanceOf<Model.FilesResult>(filesResult, "response is FilesResult");
68+
}
69+
70+
[Test]
71+
public void PostReplaceApi_Sheet_Test()
72+
{
73+
if (IsDockerTest)
74+
{
75+
Assert.IsTrue(true);
76+
return;
77+
}
78+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
79+
files.Add(BOOK1, GetTestDataStream(BOOK1));
80+
var filesResult = instance.PostReplace(files, "1", "replace ok",null,"Sheet1");
81+
Assert.IsInstanceOf<Model.FilesResult>(filesResult, "response is FilesResult");
82+
}
83+
84+
}
85+
86+
}

Aspose.Cells.Cloud.SDK.Test/LiteApi/UnlockTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public void PostUnlockApi_Test()
6262
return;
6363
}
6464
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
65-
files.Add(BOOK1, GetTestDataStream(NEEDUNLOCK));
66-
var filesResult = instance.PostUnlock(files, "12345");
65+
files.Add(NEEDUNLOCK, GetTestDataStream(NEEDUNLOCK));
66+
var filesResult = instance.PostUnlock(files, "123456");
6767
Assert.IsInstanceOf<Model.FilesResult>(filesResult, "response is FilesResult");
6868
}
6969

0 commit comments

Comments
 (0)