Skip to content

Commit 6abfa21

Browse files
committed
20201113 update 1: update test case.
1 parent c12e7c4 commit 6abfa21

25 files changed

+41
-50
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class CellsApiTests : CellsBaseTest
2222
[SetUp]
2323
public void Init()
2424
{
25-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
25+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
2626
}
2727

2828
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class CellsAutoFilterApiTests :CellsBaseTest
3131
[SetUp]
3232
public void Init()
3333
{
34-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
34+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
3535
}
3636

3737
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class CellsAutoshapesApiTests :CellsBaseTest
3232
[SetUp]
3333
public void Init()
3434
{
35-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
35+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
3636
}
3737

3838
/// <summary>

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

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Aspose.Cells.Cloud.SDK.Test
88

99
public class CellsBaseTest
1010
{
11-
protected string testbaseurl = @"https://api-qa.aspose.cloud";
11+
protected string testbaseurl = @"http://199.83.230.208";
1212
protected string apiVersion = @"v3.0";
1313
protected ApiClient client;
1414
protected Client.Configuration config;
@@ -33,25 +33,16 @@ public class CellsBaseTest
3333
protected string CellName = "A1";
3434
protected string RANGE = "A1:C10";
3535
protected string CELLAREA = "A1:C10";
36-
//private string TestDataFolder = @"D:\Projects\Aspose\Aspose.Cells.Cloud.SDK\src\TestData\";
37-
private string TestDataFolder { get
38-
{
39-
///home/runner/work/aspose-cells-cloud-dotnet/aspose-cells-cloud-dotnet/Aspose.Cells.Cloud.SDK.Test/bin/Debug/netcoreapp2.2/Book1.xlsx
40-
//home/runner/work/aspose-cells-cloud-dotnet/aspose-cells-cloud-dotnet/TestData/Book1.xlsx
41-
//string basefolder = AppDomain.CurrentDomain.BaseDirectory;
42-
//DirectoryInfo directoryInfo = new DirectoryInfo(basefolder);
43-
//for (DirectoryInfo parentDirectory = directoryInfo.Parent; parentDirectory != null ; parentDirectory = parentDirectory.Parent)
44-
//{
45-
// if (Directory.Exists(parentDirectory.FullName + @"\TestData\"))
46-
// {
47-
// return parentDirectory.FullName + @"\TestData\";
48-
// }
49-
//}
50-
//return "";
51-
return "../../../../TestData/";
52-
}
36+
protected bool IsDockerTest = true;
37+
38+
private string TestDataFolder
39+
{
40+
get
41+
{
42+
return @"C:\TestData\";
43+
}
5344
}
54-
protected void UpdateDataFile( CellsApi cellsApi, string folder, string filename)
45+
protected void UpdateDataFile(CellsApi cellsApi, string folder, string filename)
5546
{
5647
bool? exist = cellsApi.ObjectExists(folder + @"\" + filename).Exists;
5748
if (exist.HasValue && exist.Value)
@@ -61,18 +52,18 @@ protected void UpdateDataFile( CellsApi cellsApi, string folder, string filename
6152
Stream stream = GetTestDataStream(filename);
6253
var response = cellsApi.UploadFile(folder + @"\" + filename, stream);
6354
}
64-
protected void UpdateDataFile(CellsApi cellsApi, string filename)
55+
protected void UpdateDataFile(CellsApi cellsApi, string filename)
6556
{
66-
bool? exist = cellsApi.ObjectExists( filename).Exists;
57+
bool? exist = cellsApi.ObjectExists(filename).Exists;
6758
if (exist.HasValue && exist.Value)
6859
{
6960
cellsApi.DeleteFile(filename);
7061
}
71-
cellsApi.DeleteFile( filename);
62+
cellsApi.DeleteFile(filename);
7263
Stream stream = GetTestDataStream(filename);
73-
var response = cellsApi.UploadFile( filename, stream);
64+
var response = cellsApi.UploadFile(filename, stream);
7465
}
75-
protected void UpdateDataFileToOtherStorage(CellsApi cellsApi, string folder, string filename,string stroageName)
66+
protected void UpdateDataFileToOtherStorage(CellsApi cellsApi, string folder, string filename, string stroageName)
7667
{
7768
bool? exist = cellsApi.ObjectExists(folder + @"\" + filename, stroageName).Exists;
7869
if (exist.HasValue && exist.Value)
@@ -83,7 +74,7 @@ protected void UpdateDataFileToOtherStorage(CellsApi cellsApi, string folder, st
8374
var response = cellsApi.UploadFile(folder + @"\" + filename, stream, stroageName);
8475
}
8576

86-
protected Stream GetTestDataStream( string filename)
77+
protected Stream GetTestDataStream(string filename)
8778
{
8879
MemoryStream ms = new MemoryStream();
8980
FileStream fs = File.OpenRead(TestDataFolder + filename);
@@ -101,6 +92,6 @@ protected void WriteResponseStream(string filename, Stream stream)
10192
stream.CopyTo(fs);
10293
fs.Close();
10394
}
104-
95+
10596
}
10697
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CellsChartAreaApiTests : CellsBaseTest
4040
[SetUp]
4141
public void Init()
4242
{
43-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);;
43+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
4444
}
4545

4646
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CellsChartsApiTests:CellsBaseTest
4040
[SetUp]
4141
public void Init()
4242
{
43-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
43+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
4444
}
4545

4646
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CellsConditionalFormattingsApiTests:CellsBaseTest
4040
[SetUp]
4141
public void Init()
4242
{
43-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);;
43+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
4444
}
4545

4646
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CellsHypelinksApiTests : CellsBaseTest
4040
[SetUp]
4141
public void Init()
4242
{
43-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
43+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
4444
}
4545

4646
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CellsListObjectsApiTests:CellsBaseTest
4040
[SetUp]
4141
public void Init()
4242
{
43-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);;
43+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
4444
}
4545

4646
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CellsOleObjectsApiTests : CellsBaseTest
4040
[SetUp]
4141
public void Init()
4242
{
43-
instance = new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
43+
instance = IsDockerTest ? new CellsApi(testbaseurl) : new CellsApi(clientId, clientSecret, apiVersion, testbaseurl);
4444
}
4545

4646
/// <summary>

0 commit comments

Comments
 (0)