Skip to content

Commit fa033b7

Browse files
authored
Build solution with examples (#81)
* Build solution with examples * Increase Timeout for PostBarcodeRecognizeFromUrlOrContentTest
1 parent b81b248 commit fa033b7

5 files changed

Lines changed: 24 additions & 17 deletions

File tree

.github/workflows/dotnet-core.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ jobs:
3131
- name: Setup latest version of dotnet
3232
uses: actions/setup-dotnet@v3
3333
- name: Build with latest version
34-
run: dotnet build --warnaserror
34+
run: |
35+
dotnet build --warnaserror Aspose.BarCode.Cloud.Sdk.sln
36+
dotnet build --warnaserror examples/examples.sln
3537
3638
- name: Setup ${{ matrix.dotnet-version }} version of dotnet
3739
uses: actions/setup-dotnet@v3

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ update:
3434

3535
.PHONY: lint
3636
lint:
37-
dotnet build --warnaserror
37+
dotnet build --warnaserror Aspose.BarCode.Cloud.Sdk.sln
38+
dotnet build --warnaserror examples/examples.sln
3839

3940
.PHONY: clean
4041
clean:

Tests/BarcodeApiTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ public void PostBarcodeRecognizeFromUrlOrContentTest()
152152
new PostBarcodeRecognizeFromUrlOrContentRequest(image)
153153
{
154154
ChecksumValidation = ChecksumValidation.Off.ToString(),
155-
Preset = PresetType.HighPerformance.ToString()
155+
Preset = PresetType.HighPerformance.ToString(),
156+
Timeout = 30_000
156157
}
157158
);
158159

examples/GenerateQR/Program.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ static Configuration MakeConfiguration()
2828
return config;
2929
}
3030

31-
static void GenerateQR(IBarcodeApi api, string fileName)
31+
private static void GenerateQR(IBarcodeApi api, string fileName)
3232
{
3333
using (Stream generated = api.GetBarcodeGenerate(
34-
new GetBarcodeGenerateRequest(
35-
EncodeBarcodeType.QR.ToString(),
36-
"QR code text",
37-
textLocation: "None", format: "png"))
38-
)
34+
new GetBarcodeGenerateRequest(
35+
EncodeBarcodeType.QR.ToString(),
36+
"QR code text")
37+
{
38+
TextLocation = "None",
39+
format = "png"
40+
})
41+
)
3942
{
4043
using (FileStream stream = File.Create(fileName))
4144
{
@@ -47,10 +50,10 @@ static void GenerateQR(IBarcodeApi api, string fileName)
4750
static void Main(string[] args)
4851
{
4952
string fileName = Path.GetFullPath(Path.Join(
50-
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
53+
Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location),
5154
"..", "..", "..", "..",
5255
"qr.png"
53-
));
56+
));
5457

5558
var api = new BarcodeApi(MakeConfiguration());
5659

examples/ReadQR/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
namespace ReadQR
1010
{
11-
class Program
11+
internal static class Program
1212
{
13-
static Configuration MakeConfiguration()
13+
private static Configuration MakeConfiguration()
1414
{
1515
var config = new Configuration();
1616

17-
var envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
17+
string envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
1818
if (string.IsNullOrEmpty(envToken))
1919
{
2020
config.ClientId = "Client Id from https://dashboard.aspose.cloud/applications";
@@ -28,7 +28,7 @@ static Configuration MakeConfiguration()
2828
return config;
2929
}
3030

31-
static string ReadQR(IBarcodeApi api, string fileName)
31+
private static string ReadQR(IBarcodeApi api, string fileName)
3232
{
3333
using (FileStream imageStream = File.OpenRead(fileName))
3434
{
@@ -43,10 +43,10 @@ static string ReadQR(IBarcodeApi api, string fileName)
4343
static void Main(string[] args)
4444
{
4545
string fileName = Path.GetFullPath(Path.Join(
46-
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
46+
Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location),
4747
"..", "..", "..", "..",
4848
"qr.png"
49-
));
49+
));
5050

5151
var api = new BarcodeApi(MakeConfiguration());
5252

0 commit comments

Comments
 (0)