Skip to content

Commit 3db69d6

Browse files
committed
Reduce test warnings
1 parent aaf2fe8 commit 3db69d6

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

tests/Imageflow.Test/TestApi.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using System.Drawing;
23

34
using Imageflow.Bindings;
@@ -8,6 +9,7 @@
89

910
namespace Imageflow.Test
1011
{
12+
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
1113
public class TestApi
1214
{
1315
private readonly ITestOutputHelper output;
@@ -49,7 +51,7 @@ public async void TestGetImageInfoAsync()
4951
Assert.Equal(PixelFormat.Bgra_32, info.FrameDecodesInto);
5052
}
5153

52-
// Test GetImageInfo
54+
// Test GetImageInfo
5355
[Fact]
5456
public void TestGetImageInfoSync()
5557
{
@@ -403,7 +405,7 @@ public async Task TestFilesystemJobPrep()
403405
using (var file = System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(jsonPath))
404406
#pragma warning restore CA1416
405407
{
406-
} // Will throw filenotfoundexception if missing
408+
} // Will throw filenotfoundexception if missing
407409
}
408410
}
409411

tests/Imageflow.Test/TestJson.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public void TestAllJob()
5050
.RoundAllImageCornersPercent(100, AnyColor.Black)
5151
.RoundAllImageCorners(1, AnyColor.Transparent)
5252
.ConstrainWithin(5, 5)
53-
.Watermark(new MemorySource(new byte[] { }),
53+
// ReSharper disable once UseCollectionExpression
54+
.Watermark(new MemorySource(Array.Empty<byte>()),
5455
new WatermarkOptions()
5556
.SetMarginsLayout(
5657
new WatermarkMargins(WatermarkAlign.Image, 1, 1, 1, 1),
@@ -144,7 +145,7 @@ public void TestAllJob()
144145
{
145146
return null;
146147
}
147-
throw new Exception("Unexpected node type: " + n?.GetType());
148+
throw new NotSupportedException("Unexpected node type: " + n?.GetType());
148149
}
149150

150151
}

tests/Imageflow.TestWebAOT/Program.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
});
2525
imageflowApi.MapGet("/resize/width/{width}", async (int width) =>
2626
{
27-
var resultMemory = await Helpers.SizeIcon(width);
27+
var resultMemory = await Helpers.SizeIcon(width).ConfigureAwait(false);
2828
return Results.Bytes(resultMemory, "image/jpeg");
2929
});
3030

@@ -44,7 +44,7 @@ public static async Task<Memory<byte>> SizeIcon(int width)
4444
var job = await new ImageJob()
4545
.Decode(imgBytes)
4646
.Constrain(new Constraint((uint)width, 0))
47-
.EncodeToBytes(new MozJpegEncoder(90)).Finish().InProcessAsync();
47+
.EncodeToBytes(new MozJpegEncoder(90)).Finish().InProcessAsync().ConfigureAwait(false);
4848
var resultBytes = job.First!.TryGetBytes()!.Value;
4949
return new Memory<byte>(resultBytes.Array, resultBytes.Offset, resultBytes.Count);
5050
}
@@ -65,4 +65,4 @@ private static byte[] GetResourceBytes(string resourceName)
6565

6666

6767
[JsonSerializable(typeof(VersionInfo))]
68-
internal partial class AppJsonSerializerContext : JsonSerializerContext;
68+
internal sealed partial class AppJsonSerializerContext : JsonSerializerContext;

0 commit comments

Comments
 (0)