dbeec2e9f0
Refactor test code in Jellyfin.Extensions.Tests for clarity and consistency: - Use explicit object initializers and collection expressions - Standardize field naming and use of this. - Add/improve XML doc comments for test methods - Use new(...) syntax for Guid/Version instantiation - Convert file-scoped to block-scoped namespaces in key tests - Nest test classes and use instance methods in enum tests - Enable XML docs and suppress select warnings in csproj - No changes to test or converter logic; style and maintainability only
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
// <copyright file="JsonFlagEnumTests.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Extensions.Tests.Json.Converters
|
|
{
|
|
using System.Text.Json;
|
|
using Jellyfin.Extensions.Json.Converters;
|
|
using MediaBrowser.Model.Session;
|
|
using Xunit;
|
|
|
|
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)
|
|
{
|
|
string result = JsonSerializer.Serialize(transcodeReason, this._jsonOptions);
|
|
|
|
Assert.Equal(output, result);
|
|
}
|
|
}
|
|
}
|