Skip to content

Commit 065d40d

Browse files
committed
20210712 update 1 : add liteapi and test.
1 parent e0e45a2 commit 065d40d

19 files changed

+2189
-23
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void CellsPropertiesPutDocumentPropertyTest()
131131
UpdateDataFile(instance,folder, name);
132132
var response = instance.CellsPropertiesPutDocumentProperty(name, propertyName, property, folder);
133133
Assert.IsInstanceOf<CellsDocumentPropertyResponse>(response, "response is CellsDocumentPropertyResponse");
134-
Assert.AreEqual(response.Code, 201);
134+
Assert.AreEqual(response.Code, 200);
135135
}
136136

137137
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Aspose.Cells.Cloud.SDK.Test
3131
/// Please update the test case below to test the API endpoint.
3232
/// </remarks>
3333
[TestFixture]
34-
public class OAuthApiTests:CellsBaseTest
34+
public class OAuthApieTests : CellsBaseTest
3535
{
3636
private CellsApi instance;
3737

Aspose.Cells.Cloud.SDK.Test/Api/CellsBaseTest.cs renamed to Aspose.Cells.Cloud.SDK.Test/CellsBaseTest.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ protected string clientSecret
2727
protected static string accesstoken;
2828
protected string refreshtoken;
2929
protected string BOOK1 = "Book1.xlsx";
30+
protected string DataSource = "datasource.xlsx";
31+
protected string AssemblyTest = "assemblytest.xlsx";
3032
protected string MYDOC = "myDocument.xlsx";
3133
protected string PivTestFile = "TestCase.xlsx";
3234
protected string PivTestFile2 = "PivTestFile2.xlsx";
3335
protected string TEMPFOLDER = "DotnetTest";
36+
protected string NEEDUNLOCK = "needUnlock.xlsx";
3437
protected string SHEET1 = "Sheet1";
3538
protected string SHEET2 = "Sheet2";
3639
protected string SHEET3 = "Sheet3";
@@ -86,6 +89,11 @@ protected void UpdateDataFileToOtherStorage(CellsApi cellsApi, string folder, st
8689
var response = cellsApi.UploadFile(folder + @"\" + filename, stream, stroageName);
8790
}
8891

92+
protected FileStream GetFileStream(string filename)
93+
{
94+
return File.OpenRead(TestDataFolder + filename);
95+
}
96+
8997
protected Stream GetTestDataStream(string filename)
9098
{
9199
MemoryStream ms = new MemoryStream();
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 AssembleTests: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+
/// <summary>
56+
/// Test OAuthPost
57+
/// </summary>
58+
[Test]
59+
public void PostAssembleApiTest()
60+
{
61+
if(IsDockerTest)
62+
{
63+
Assert.IsTrue(true);
64+
return;
65+
}
66+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
67+
files.Add(DataSource, GetTestDataStream( DataSource));
68+
files.Add(AssemblyTest, GetTestDataStream(AssemblyTest));
69+
var filesResult = instance.PostAssemble( files, "ds");
70+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
71+
}
72+
73+
}
74+
75+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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 ClearObjectsTests : 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+
/// <summary>
56+
///
57+
/// </summary>
58+
[Test]
59+
public void PostClearObjectsApi_Comment_Test()
60+
{
61+
if(IsDockerTest)
62+
{
63+
Assert.IsTrue(true);
64+
return;
65+
}
66+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
67+
files.Add(DataSource, GetTestDataStream( DataSource));
68+
files.Add(AssemblyTest, GetTestDataStream(AssemblyTest));
69+
var filesResult = instance.PostCleaeObjects(files,"comment");
70+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
71+
}
72+
73+
[Test]
74+
public void PostClearObjectsApi_Chart_Test()
75+
{
76+
if (IsDockerTest)
77+
{
78+
Assert.IsTrue(true);
79+
return;
80+
}
81+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
82+
files.Add(DataSource, GetTestDataStream(DataSource));
83+
files.Add(AssemblyTest, GetTestDataStream(AssemblyTest));
84+
var filesResult = instance.PostCleaeObjects(files,"chart");
85+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
86+
}
87+
88+
[Test]
89+
public void PostClearObjectsApi_Picture_Test()
90+
{
91+
if (IsDockerTest)
92+
{
93+
Assert.IsTrue(true);
94+
return;
95+
}
96+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
97+
files.Add(DataSource, GetTestDataStream(DataSource));
98+
files.Add(AssemblyTest, GetTestDataStream(AssemblyTest));
99+
var filesResult = instance.PostCleaeObjects(files,"picture");
100+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
101+
}
102+
103+
[Test]
104+
public void PostClearObjectsApi_Shape_Test()
105+
{
106+
if (IsDockerTest)
107+
{
108+
Assert.IsTrue(true);
109+
return;
110+
}
111+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
112+
files.Add(DataSource, GetTestDataStream(DataSource));
113+
files.Add(AssemblyTest, GetTestDataStream(AssemblyTest));
114+
var filesResult = instance.PostCleaeObjects(files,"shape");
115+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
116+
}
117+
}
118+
119+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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 ExportTests : 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 PostExportApi_Chart_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+
files.Add(MYDOC, GetTestDataStream(MYDOC));
67+
var filesResult = instance.PostExport(files,"chart","png");
68+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
69+
}
70+
71+
[Test]
72+
public void PostExportApi_Workbook_Test()
73+
{
74+
if (IsDockerTest)
75+
{
76+
Assert.IsTrue(true);
77+
return;
78+
}
79+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
80+
files.Add(BOOK1, GetTestDataStream(BOOK1));
81+
files.Add(MYDOC, GetTestDataStream(MYDOC));
82+
var filesResult = instance.PostExport(files,"workbook", "png");
83+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
84+
}
85+
86+
[Test]
87+
public void PostExportApi_Picture_Test()
88+
{
89+
if (IsDockerTest)
90+
{
91+
Assert.IsTrue(true);
92+
return;
93+
}
94+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
95+
files.Add(BOOK1, GetTestDataStream(BOOK1));
96+
files.Add(MYDOC, GetTestDataStream(MYDOC));
97+
var filesResult = instance.PostExport(files,"picture", "png");
98+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
99+
}
100+
[Test]
101+
public void PostExportApi_Shape_Test()
102+
{
103+
if (IsDockerTest)
104+
{
105+
Assert.IsTrue(true);
106+
return;
107+
}
108+
IDictionary<string, Stream> files = new Dictionary<string, Stream>();
109+
files.Add(BOOK1, GetTestDataStream(BOOK1));
110+
files.Add(MYDOC, GetTestDataStream(MYDOC));
111+
var filesResult = instance.PostExport(files,"shape", "png");
112+
Assert.IsInstanceOf<FilesResult>(filesResult, "response is AccessTokenResponse");
113+
}
114+
}
115+
116+
}

0 commit comments

Comments
 (0)