Skip to content

Commit 0c0f70b

Browse files
committed
Throw SkipException to make it more clear which unit tests are skipped.
1 parent 6315b2c commit 0c0f70b

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

tests/Magick.NET.Tests/Coders/TheEpsCoder.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using ImageMagick;
55
using Xunit;
6+
using Xunit.Sdk;
67

78
namespace Magick.NET.Tests;
89

@@ -12,7 +13,7 @@ public partial class TheEpsCoder
1213
public void ShouldReadTwoImages()
1314
{
1415
if (!Ghostscript.IsAvailable)
15-
return;
16+
throw SkipException.ForSkip("Ghostscript is not available");
1617

1718
using var images = new MagickImageCollection(Files.Coders.SwedenHeartEPS);
1819

@@ -31,7 +32,7 @@ public void ShouldReadTwoImages()
3132
public void ShouldReadMonoChromeImageWhenUseMonochromeIsTrue()
3233
{
3334
if (!Ghostscript.IsAvailable)
34-
return;
35+
throw SkipException.ForSkip("Ghostscript is not available");
3536

3637
var settings = new MagickReadSettings
3738
{
@@ -52,7 +53,7 @@ public void ShouldReadMonoChromeImageWhenUseMonochromeIsTrue()
5253
public void ShouldReadClipPathsInTiffPreview()
5354
{
5455
if (!Ghostscript.IsAvailable)
55-
return;
56+
throw SkipException.ForSkip("Ghostscript is not available");
5657

5758
using var images = new MagickImageCollection(Files.Coders.SwedenHeartEPS);
5859

tests/Magick.NET.Tests/Coders/ThePdfCoder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading.Tasks;
55
using ImageMagick;
66
using Xunit;
7+
using Xunit.Sdk;
78

89
namespace Magick.NET.Tests;
910

@@ -13,7 +14,7 @@ public partial class ThePdfCoder
1314
public async Task ShouldReadFileMultithreadedCorrectly()
1415
{
1516
if (!Ghostscript.IsAvailable)
16-
return;
17+
throw SkipException.ForSkip("Ghostscript is not available");
1718

1819
var results = new Task[3];
1920

@@ -40,7 +41,7 @@ public async Task ShouldReadFileMultithreadedCorrectly()
4041
public void ShouldReturnTheCorrectFormatForAiFile()
4142
{
4243
if (!Ghostscript.IsAvailable)
43-
return;
44+
throw SkipException.ForSkip("Ghostscript is not available");
4445

4546
using var image = new MagickImage(Files.Coders.CartoonNetworkStudiosLogoAI);
4647

tests/Magick.NET.Tests/Formats/Pdf/PdfInfoTests/TheCreateMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using ImageMagick;
77
using ImageMagick.Formats;
88
using Xunit;
9+
using Xunit.Sdk;
910

1011
namespace Magick.NET.Tests;
1112

@@ -56,7 +57,7 @@ public void ShouldThrowExceptionWhenPasswordIsNull()
5657
public void ShouldThrowExceptionWhenFileIsPng()
5758
{
5859
if (!Ghostscript.IsAvailable)
59-
return;
60+
throw SkipException.ForSkip("Ghostscript is not available");
6061

6162
MagickErrorException? exception = null;
6263

tests/Magick.NET.Tests/Formats/Pdf/PdfInfoTests/ThePageCountProperty.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using ImageMagick.Formats;
55
using Xunit;
6+
using Xunit.Sdk;
67

78
namespace Magick.NET.Tests;
89

@@ -14,7 +15,7 @@ public class ThePageCountProperty
1415
public void ShouldReturnTheNumberOfPages()
1516
{
1617
if (!Ghostscript.IsAvailable)
17-
return;
18+
throw SkipException.ForSkip("Ghostscript is not available");
1819

1920
var pdfInfo = PdfInfo.Create(Files.Coders.SamplePDF);
2021
Assert.Equal(2U, pdfInfo.PageCount);
@@ -24,7 +25,7 @@ public void ShouldReturnTheNumberOfPages()
2425
public void ShouldReturnTheNumberOfPagesForPasswordProtectedFile()
2526
{
2627
if (!Ghostscript.IsAvailable)
27-
return;
28+
throw SkipException.ForSkip("Ghostscript is not available");
2829

2930
var pdfInfo = PdfInfo.Create(Files.Coders.PdfExamplePasswordOriginalPDF, "test");
3031
Assert.Equal(4U, pdfInfo.PageCount);

tests/Magick.NET.Tests/Formats/Pdf/PdfReadDefinesTests/TheFitPageProperty.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using ImageMagick;
55
using ImageMagick.Formats;
66
using Xunit;
7+
using Xunit.Sdk;
78

89
namespace Magick.NET.Tests;
910

@@ -39,7 +40,7 @@ public void ShouldNotSetTheDefineWhenValueIsNotSet()
3940
public void ShouldLimitTheDimensions()
4041
{
4142
if (!Ghostscript.IsAvailable)
42-
return;
43+
throw SkipException.ForSkip("Ghostscript is not available");
4344

4445
var settings = new MagickReadSettings
4546
{

tests/Magick.NET.Tests/Formats/Pdf/PdfReadDefinesTests/ThePasswordProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void ShouldNotSetTheDefineWhenValueIsNotSet()
4141
public void ShouldUseThePasswordToReadTheImage()
4242
{
4343
if (!Ghostscript.IsAvailable)
44-
return;
44+
throw SkipException.ForSkip("Ghostscript is not available");
4545

4646
var settings = new MagickReadSettings
4747
{
@@ -62,7 +62,7 @@ public void ShouldUseThePasswordToReadTheImage()
6262
public void ShouldNotBeAbleToOpenFileWithNullPassword()
6363
{
6464
if (!Ghostscript.IsAvailable)
65-
return;
65+
throw SkipException.ForSkip("Ghostscript is not available");
6666

6767
var settings = new MagickReadSettings
6868
{

tests/Magick.NET.Tests/MagickImageTests/TheReadMethod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Text;
77
using ImageMagick;
88
using Xunit;
9+
using Xunit.Sdk;
910

1011
namespace Magick.NET.Tests;
1112

@@ -487,7 +488,7 @@ public void ShouldNotUseBaseDirectoryOfCurrentAppDomainWhenFileNameIsTilde()
487488
public void ShouldReadAIFromNonSeekableStream()
488489
{
489490
if (!Ghostscript.IsAvailable)
490-
return;
491+
throw SkipException.ForSkip("Ghostscript is not available");
491492

492493
using var stream = new NonSeekableStream(Files.Coders.CartoonNetworkStudiosLogoAI);
493494
using var image = new MagickImage();

0 commit comments

Comments
 (0)