Skip to content

Commit 9aed71f

Browse files
authored
Release 24.3 (#85)
* Version updated. Removed obsolete sync methods
1 parent 61affab commit 9aed71f

39 files changed

Lines changed: 111 additions & 2085 deletions

.github/workflows/net-framework.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
$ErrorActionPreference = "Stop"
4343
VSTest.Console.exe /Framework:".NETFramework,Version=${{ matrix.net-version }}" /ResultsDirectory:Tests\Results /Logger:"trx;LogFileName=test.log" Tests\bin\Release\${{ matrix.framework }}\Aspose.BarCode.Cloud.Sdk.Tests.dll
44-
if( ([xml](Get-Content Tests\Results\test.log)).TestRun.ResultSummary.Counters.total -ne 38 ){ throw "Not all tests were explored or added new tests" }
44+
if( ([xml](Get-Content Tests\Results\test.log)).TestRun.ResultSummary.Counters.total -ne 26 ){ throw "Not all tests were explored or added new tests" }
4545
4646
env:
4747
TEST_CONFIGURATION_JWT_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Nuget](https://img.shields.io/nuget/v/Aspose.BarCode-Cloud)](https://www.nuget.org/packages/Aspose.BarCode-Cloud/)
77

88
- API version: 3.0
9-
- SDK version: 24.2.0
9+
- SDK version: 24.3.0
1010

1111
## Demo applications
1212

Tests/ApiExceptionTests.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,6 @@ namespace Aspose.BarCode.Cloud.Sdk.Tests
1010
[TestFixture]
1111
public class ApiExceptionTests : TestsBase
1212
{
13-
[Test]
14-
public void GetBarcodeGenerateTestThrows()
15-
{
16-
// Arrange
17-
var api = new BarcodeApi(clientId: "client id", clientSecret: "client secret");
18-
var request = new GetBarcodeGenerateRequest(
19-
text: "Very sample text",
20-
type: EncodeBarcodeType.Code128.ToString()
21-
)
22-
{
23-
format = "png"
24-
};
25-
26-
// Act
27-
var ex = Assert.Throws<ApiException>(
28-
() =>
29-
{
30-
#pragma warning disable CS0618 // Method is obsolete
31-
api.GetBarcodeGenerate(request);
32-
#pragma warning restore CS0618 // Method is obsolete
33-
});
34-
35-
// Assert
36-
Assert.AreEqual(400, ex!.ErrorCode);
37-
Assert.AreEqual("Bad Request", ex.Message);
38-
}
3913

4014
[Test]
4115
[Category("AsyncTests")]

Tests/BarcodeApiTests.cs

Lines changed: 0 additions & 278 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,6 @@ public void Cleanup()
4141
private IBarcodeApi _api;
4242
private IFileApi _fileApi;
4343

44-
private string PutTestFile(string fileName)
45-
{
46-
using FileStream fileToUpload = File.Open(TestFilePath(fileName), FileMode.Open, FileAccess.Read);
47-
#pragma warning disable CS0618 // Method is obsolete
48-
FilesUploadResult uploaded = _fileApi.UploadFile(
49-
#pragma warning restore CS0618 // Method is obsolete
50-
new UploadFileRequest(
51-
$"{TempFolderPath}/{fileName}",
52-
fileToUpload
53-
)
54-
);
55-
Assert.IsNotEmpty(uploaded.Uploaded);
56-
57-
return TempFolderPath;
58-
}
59-
6044
private async Task<string> PutTestFileAsync(string fileName)
6145
{
6246
using FileStream fileToUpload = File.Open(TestFilePath(fileName), FileMode.Open, FileAccess.Read);
@@ -72,84 +56,6 @@ private async Task<string> PutTestFileAsync(string fileName)
7256
}
7357

7458

75-
/// <summary>
76-
/// Test GetBarcodeGenerate
77-
/// </summary>
78-
[Test]
79-
public void GetBarcodeGenerateTest()
80-
{
81-
// Arrange
82-
var request = new GetBarcodeGenerateRequest(
83-
text: "Very sample text",
84-
type: EncodeBarcodeType.Code128.ToString()
85-
)
86-
{
87-
format = "png"
88-
};
89-
90-
// Act
91-
#pragma warning disable CS0618 // Method is obsolete
92-
using Stream response = _api.GetBarcodeGenerate(request);
93-
#pragma warning restore CS0618 // Method is obsolete
94-
// Assert
95-
Assert.IsTrue(response.Length > 0);
96-
using FileStream savedFileStream = File.Create(TestFilePath("Test_GetBarcodeGenerate.png"));
97-
response.CopyTo(savedFileStream);
98-
}
99-
100-
101-
/// <summary>
102-
/// Test GetBarcodeRecognize
103-
/// </summary>
104-
[Test]
105-
public void GetBarcodeRecognizeTest()
106-
{
107-
// Arrange
108-
const string fileName = "Test_PostGenerateMultiple.png";
109-
110-
var expectedBarcodes = new List<GeneratorParams>
111-
{
112-
new GeneratorParams
113-
{
114-
TypeOfBarcode = EncodeBarcodeType.QR,
115-
Text = "Hello world!"
116-
},
117-
new GeneratorParams
118-
{
119-
TypeOfBarcode = EncodeBarcodeType.Code128,
120-
Text = "Hello world!"
121-
}
122-
};
123-
124-
string folder = PutTestFile(fileName);
125-
126-
// Act
127-
#pragma warning disable CS0618 // Method is obsolete
128-
BarcodeResponseList response = _api.GetBarcodeRecognize(
129-
#pragma warning restore CS0618 // Method is obsolete
130-
new GetBarcodeRecognizeRequest(
131-
fileName
132-
)
133-
{
134-
folder = folder,
135-
Preset = PresetType.HighPerformance.ToString(),
136-
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.QR, DecodeBarcodeType.Code128 }
137-
}
138-
);
139-
140-
// Assert
141-
Assert.AreEqual(expectedBarcodes.Count, response.Barcodes.Count);
142-
143-
foreach ((GeneratorParams generated, BarcodeResponse recognized) in
144-
expectedBarcodes.Zip(response.Barcodes,
145-
(generated, recognized) => (generated, recognized)))
146-
{
147-
Assert.AreEqual(generated.TypeOfBarcode.ToString(), recognized.Type);
148-
Assert.AreEqual(generated.Text, recognized.BarcodeValue);
149-
}
150-
}
151-
152-
15359
/// <summary>
15460
/// Test an instance of BarcodeApi
15561
/// </summary>
@@ -159,190 +65,6 @@ public void InstanceTest()
15965
Assert.IsInstanceOf(typeof(IBarcodeApi), _api, "instance is a IBarcodeApi");
16066
}
16167

162-
163-
/// <summary>
164-
/// Test PostBarcodeRecognizeFromUrlOrContent
165-
/// </summary>
166-
[Test]
167-
public void PostBarcodeRecognizeFromUrlOrContentTest()
168-
{
169-
// Arrange
170-
using Stream image = GetTestImage("1.png");
171-
172-
// Act
173-
#pragma warning disable CS0618 // Method is obsolete
174-
BarcodeResponseList response = _api.PostBarcodeRecognizeFromUrlOrContent(
175-
#pragma warning restore CS0618 // Method is obsolete
176-
new PostBarcodeRecognizeFromUrlOrContentRequest(image)
177-
{
178-
ChecksumValidation = ChecksumValidation.Off.ToString(),
179-
Preset = PresetType.HighPerformance.ToString(),
180-
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.Code11 }
181-
}
182-
);
183-
184-
// Assert
185-
Assert.AreEqual(1, response.Barcodes.Count);
186-
Assert.IsFalse(string.IsNullOrWhiteSpace(response.Barcodes[0].ToString()),
187-
message: $"Empty BarcodeResponse.ToString()");
188-
Assert.AreEqual(DecodeBarcodeType.Code11.ToString(), response.Barcodes[0].Type);
189-
Assert.AreEqual("1234567812", response.Barcodes[0].BarcodeValue);
190-
}
191-
192-
193-
/// <summary>
194-
/// Test PostGenerateMultiple
195-
/// </summary>
196-
[Test]
197-
public void PostGenerateMultipleTest()
198-
{
199-
// Arrange
200-
var request = new PostGenerateMultipleRequest(
201-
new GeneratorParamsList
202-
{
203-
BarcodeBuilders = new List<GeneratorParams>
204-
{
205-
new GeneratorParams
206-
{
207-
TypeOfBarcode = EncodeBarcodeType.QR,
208-
Text = "Hello world!"
209-
},
210-
new GeneratorParams
211-
{
212-
TypeOfBarcode = EncodeBarcodeType.Code128,
213-
Text = "Hello world!"
214-
}
215-
}
216-
}
217-
);
218-
219-
// Act
220-
#pragma warning disable CS0618 // Method is obsolete
221-
using Stream response = _api.PostGenerateMultiple(request);
222-
#pragma warning restore CS0618 // Method is obsolete
223-
224-
// Assert
225-
Assert.IsTrue(response.Length > 0);
226-
using FileStream savedFileStream = File.Create(TestFilePath("Test_PostGenerateMultiple.png"));
227-
response.CopyTo(savedFileStream);
228-
}
229-
230-
231-
/// <summary>
232-
/// Test PutBarcodeGenerateFile
233-
/// </summary>
234-
[Test]
235-
public void PutBarcodeGenerateFileTest()
236-
{
237-
// Arrange
238-
var request = new PutBarcodeGenerateFileRequest(
239-
"Test_PutBarcodeGenerateFile.png",
240-
type: EncodeBarcodeType.Code128.ToString(),
241-
text: "Hello!"
242-
)
243-
{
244-
folder = TempFolderPath
245-
};
246-
247-
// Act
248-
#pragma warning disable CS0618 // Method is obsolete
249-
ResultImageInfo response = _api.PutBarcodeGenerateFile(request);
250-
#pragma warning restore CS0618 // Method is obsolete
251-
252-
// Assert
253-
Assert.True(response.FileSize > 0);
254-
Assert.True(response.ImageWidth > 0);
255-
Assert.True(response.ImageHeight > 0);
256-
}
257-
258-
259-
/// <summary>
260-
/// Test PutBarcodeRecognizeFromBody
261-
/// </summary>
262-
[Test]
263-
public void PutBarcodeRecognizeFromBodyTest()
264-
{
265-
// Arrange
266-
var barcodesToRecognize = new List<GeneratorParams>
267-
{
268-
new GeneratorParams
269-
{
270-
TypeOfBarcode = EncodeBarcodeType.Code128,
271-
Text = "Very sample text"
272-
}
273-
};
274-
275-
const string fileName = "Test_GetBarcodeGenerate.png";
276-
string folder = PutTestFile(fileName);
277-
278-
// Act
279-
#pragma warning disable CS0618 // Method is obsolete
280-
BarcodeResponseList response = _api.PutBarcodeRecognizeFromBody(
281-
#pragma warning restore CS0618 // Method is obsolete
282-
new PutBarcodeRecognizeFromBodyRequest(
283-
fileName,
284-
readerParams: new ReaderParams
285-
{
286-
Preset = PresetType.HighPerformance,
287-
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.Code128 }
288-
}
289-
)
290-
{
291-
folder = folder
292-
}
293-
);
294-
295-
// Assert
296-
Assert.AreEqual(barcodesToRecognize.Count, response.Barcodes.Count);
297-
298-
foreach ((GeneratorParams generated, BarcodeResponse recognized) in
299-
barcodesToRecognize.Zip(response.Barcodes,
300-
(generated, recognized) => (generated, recognized)))
301-
{
302-
Assert.AreEqual(generated.TypeOfBarcode.ToString(), recognized.Type);
303-
Assert.AreEqual(generated.Text, recognized.BarcodeValue);
304-
}
305-
}
306-
307-
308-
/// <summary>
309-
/// Test PutGenerateMultiple
310-
/// </summary>
311-
[Test]
312-
public void PutGenerateMultipleTest()
313-
{
314-
// Arrange
315-
var generatorParamsList = new GeneratorParamsList
316-
{
317-
BarcodeBuilders = new List<GeneratorParams>
318-
{
319-
new GeneratorParams
320-
{
321-
TypeOfBarcode = EncodeBarcodeType.Code128,
322-
Text = "Hello world!"
323-
}
324-
}
325-
};
326-
327-
var request = new PutGenerateMultipleRequest(
328-
"Test_PutGenerateMultiple.png",
329-
generatorParamsList
330-
)
331-
{
332-
folder = TempFolderPath
333-
};
334-
335-
// Act
336-
#pragma warning disable CS0618 // Method is obsolete
337-
ResultImageInfo response = _api.PutGenerateMultiple(request);
338-
#pragma warning restore CS0618 // Method is obsolete
339-
340-
// Assert
341-
Assert.True(response.FileSize > 0);
342-
Assert.True(response.ImageWidth > 0);
343-
Assert.True(response.ImageHeight > 0);
344-
}
345-
34668
/// <summary>
34769
/// Test GetBarcodeGenerateAsync
34870
/// </summary>

Tests/GenerateAndThenRecognize.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,6 @@ public void Init()
2121

2222
private IBarcodeApi _api;
2323

24-
[Test]
25-
public void GenerateAndThenRecognizeTest()
26-
{
27-
#pragma warning disable CS0618 // Method is obsolete
28-
Stream generatedImage = _api.GetBarcodeGenerate(
29-
#pragma warning restore CS0618 // Method is obsolete
30-
new GetBarcodeGenerateRequest(EncodeBarcodeType.QR.ToString(), "Test"));
31-
32-
#pragma warning disable CS0618 // Type or member is obsolete
33-
BarcodeResponseList recognized = _api.PostBarcodeRecognizeFromUrlOrContent(
34-
#pragma warning restore CS0618 // Type or member is obsolete
35-
new PostBarcodeRecognizeFromUrlOrContentRequest(generatedImage)
36-
{
37-
Preset = PresetType.HighPerformance.ToString(),
38-
Types = new List<DecodeBarcodeType>
39-
{
40-
DecodeBarcodeType.QR
41-
}
42-
}
43-
);
44-
45-
Assert.AreEqual(1, recognized.Barcodes.Count);
46-
Assert.AreEqual(DecodeBarcodeType.QR.ToString(), recognized.Barcodes.First().Type);
47-
Assert.AreEqual("Test", recognized.Barcodes.First().BarcodeValue);
48-
Assert.AreEqual(
49-
"{\"barcodes\":[{" +
50-
"\"barcodeValue\":\"Test\"," +
51-
"\"type\":\"QR\"," +
52-
"\"region\":[{\"x\":7,\"y\":7},{\"x\":49,\"y\":6},{\"x\":48,\"y\":48},{\"x\":6,\"y\":49}]}]}",
53-
recognized.ToString()
54-
);
55-
}
56-
5724
[Test]
5825
[Category("AsyncTests")]
5926
public async Task GenerateAndThenRecognizeAsyncTest()

0 commit comments

Comments
 (0)