diff options
| author | Cody Robibero <cody@robibe.ro> | 2022-03-05 13:58:21 -0700 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2022-03-06 18:13:54 -0700 |
| commit | bbd5d11d3b62f0edc1456a8116753ea0fbaec04f (patch) | |
| tree | 00787fed6770deae18cc6ac9100fa14302770699 /tests/Jellyfin.Extensions.Tests/Json | |
| parent | c331e11c24128bf8f969097afd342353e244ada1 (diff) | |
Remove TranscodeReason.None, Add JsonFlagEnum tests
Diffstat (limited to 'tests/Jellyfin.Extensions.Tests/Json')
| -rw-r--r-- | tests/Jellyfin.Extensions.Tests/Json/Converters/JsonFlagEnumTests.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonFlagEnumTests.cs b/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonFlagEnumTests.cs new file mode 100644 index 0000000000..c8652b3233 --- /dev/null +++ b/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonFlagEnumTests.cs @@ -0,0 +1,28 @@ +using System.Text.Json; +using Jellyfin.Extensions.Json.Converters; +using MediaBrowser.Model.Session; +using Xunit; + +namespace Jellyfin.Extensions.Tests.Json.Converters; + +public class JsonFlagEnumTests +{ + private readonly JsonSerializerOptions _jsonOptions = new() + { + Converters = + { + new JsonFlagEnumConverter<TranscodeReason>() + } + }; + + [Theory] + [InlineData(TranscodeReason.AudioIsExternal | TranscodeReason.ContainerNotSupported, "[\"ContainerNotSupported\",\"AudioIsExternal\"]")] + [InlineData(TranscodeReason.AudioIsExternal | TranscodeReason.ContainerNotSupported | TranscodeReason.VideoBitDepthNotSupported, "[\"ContainerNotSupported\",\"AudioIsExternal\",\"VideoBitDepthNotSupported\"]")] + [InlineData((TranscodeReason)0, "[]")] + public void Serialize_Transcode_Reason(TranscodeReason transcodeReason, string output) + { + var result = JsonSerializer.Serialize(transcodeReason, _jsonOptions); + + Assert.Equal(output, result); + } +} |
