diff options
| author | Cody Robibero <cody@robibe.ro> | 2022-01-08 04:45:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-08 04:45:58 -0700 |
| commit | 9b1965b48ace52d325aeedf31932a860ffadea3f (patch) | |
| tree | 846e5d2ca77b7a8a764e9afaa5be610885126cc2 /tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs | |
| parent | ce61dff4aae0875cfc359c9d8dc1a8a15f9409cd (diff) | |
| parent | dc222b75c55645fce521c572acebb16b278169a5 (diff) | |
Merge pull request #7101 from Bond-009/imagejpg
Remove incorrect mime type image/jpg
Diffstat (limited to 'tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs')
| -rw-r--r-- | tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs b/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs new file mode 100644 index 000000000..7c3a7ff6c --- /dev/null +++ b/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs @@ -0,0 +1,33 @@ +using System; +using System.ComponentModel; +using MediaBrowser.Model.Drawing; +using Xunit; + +namespace Jellyfin.Model.Drawing; + +public static class ImageFormatExtensionsTests +{ + private static TheoryData<ImageFormat> GetAllImageFormats() + { + var theoryTypes = new TheoryData<ImageFormat>(); + foreach (var x in Enum.GetValues<ImageFormat>()) + { + theoryTypes.Add(x); + } + + return theoryTypes; + } + + [Theory] + [MemberData(nameof(GetAllImageFormats))] + public static void GetMimeType_Valid_Valid(ImageFormat format) + => Assert.Null(Record.Exception(() => format.GetMimeType())); + + [Theory] + [InlineData((ImageFormat)int.MinValue)] + [InlineData((ImageFormat)int.MaxValue)] + [InlineData((ImageFormat)(-1))] + [InlineData((ImageFormat)5)] + public static void GetMimeType_Valid_ThrowsInvalidEnumArgumentException(ImageFormat format) + => Assert.Throws<InvalidEnumArgumentException>(() => format.GetMimeType()); +} |
