The Free Software Media System - Server Backend & API
Fix build errors from new warnings
Cody Robibero6004060b4ea6
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.csindex 8e1acc46c9..115f085ff8 100644--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs@@ -746,7 +746,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles}}- internal readonly struct SubtitleInfo+ public readonly struct SubtitleInfo{public SubtitleInfo(string path, MediaProtocol protocol, string format, bool isExternal){diff --git a/tests/Jellyfin.Api.Tests/Auth/DefaultAuthorizationPolicy/DefaultAuthorizationHandlerTests.cs b/tests/Jellyfin.Api.Tests/Auth/DefaultAuthorizationPolicy/DefaultAuthorizationHandlerTests.csindex 23c51999fa..7c85ddd620 100644--- a/tests/Jellyfin.Api.Tests/Auth/DefaultAuthorizationPolicy/DefaultAuthorizationHandlerTests.cs+++ b/tests/Jellyfin.Api.Tests/Auth/DefaultAuthorizationPolicy/DefaultAuthorizationHandlerTests.cs@@ -62,7 +62,7 @@ namespace Jellyfin.Api.Tests.Auth.DefaultAuthorizationPolicy}}- private static TheoryData<string, Dictionary<string, string>> GetParts_ValidAuthHeader_Success_Data()+ public static TheoryData<string, Dictionary<string, string>> GetParts_ValidAuthHeader_Success_Data(){var data = new TheoryData<string, Dictionary<string, string>>();diff --git a/tests/Jellyfin.Api.Tests/ModelBinders/CommaDelimitedArrayModelBinderTests.cs b/tests/Jellyfin.Api.Tests/ModelBinders/CommaDelimitedArrayModelBinderTests.csindex 3ae6ae5bdd..e37c9d91f3 100644--- a/tests/Jellyfin.Api.Tests/ModelBinders/CommaDelimitedArrayModelBinderTests.cs+++ b/tests/Jellyfin.Api.Tests/ModelBinders/CommaDelimitedArrayModelBinderTests.cs@@ -192,7 +192,9 @@ namespace Jellyfin.Api.Tests.ModelBindersawait modelBinder.BindModelAsync(bindingContextMock.Object);Assert.True(bindingContextMock.Object.Result.IsModelSet);- Assert.Empty((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model);+ var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;+ Assert.NotNull(listResult);+ Assert.Empty(listResult);}[Fact]@@ -220,7 +222,9 @@ namespace Jellyfin.Api.Tests.ModelBindersawait modelBinder.BindModelAsync(bindingContextMock.Object);Assert.True(bindingContextMock.Object.Result.IsModelSet);- Assert.Single((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model);+ var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;+ Assert.NotNull(listResult);+ Assert.Single(listResult);}}}diff --git a/tests/Jellyfin.Api.Tests/ModelBinders/PipeDelimitedArrayModelBinderTests.cs b/tests/Jellyfin.Api.Tests/ModelBinders/PipeDelimitedArrayModelBinderTests.csindex 938d19a154..7c05ee0362 100644--- a/tests/Jellyfin.Api.Tests/ModelBinders/PipeDelimitedArrayModelBinderTests.cs+++ b/tests/Jellyfin.Api.Tests/ModelBinders/PipeDelimitedArrayModelBinderTests.cs@@ -192,7 +192,9 @@ namespace Jellyfin.Api.Tests.ModelBindersawait modelBinder.BindModelAsync(bindingContextMock.Object);Assert.True(bindingContextMock.Object.Result.IsModelSet);- Assert.Empty((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model);+ var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;+ Assert.NotNull(listResult);+ Assert.Empty(listResult);}[Fact]@@ -220,7 +222,9 @@ namespace Jellyfin.Api.Tests.ModelBindersawait modelBinder.BindModelAsync(bindingContextMock.Object);Assert.True(bindingContextMock.Object.Result.IsModelSet);- Assert.Single((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model);+ var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;+ Assert.NotNull(listResult);+ Assert.Single(listResult);}}}diff --git a/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonStringConverterTests.cs b/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonStringConverterTests.csindex 345f37cbe0..77717af703 100644--- a/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonStringConverterTests.cs+++ b/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonStringConverterTests.cs@@ -32,7 +32,7 @@ namespace Jellyfin.Extensions.Tests.Json.Convertersconst string? input = "123";const int output = 123;var deserialized = JsonSerializer.Deserialize<int>(input, _jsonSerializerOptions);- Assert.Equal(deserialized, output);+ Assert.Equal(output, deserialized);}}}diff --git a/tests/Jellyfin.MediaEncoding.Hls.Tests/Playlist/DynamicHlsPlaylistGeneratorTests.cs b/tests/Jellyfin.MediaEncoding.Hls.Tests/Playlist/DynamicHlsPlaylistGeneratorTests.csindex 79648c4f6e..bbacdcd629 100644--- a/tests/Jellyfin.MediaEncoding.Hls.Tests/Playlist/DynamicHlsPlaylistGeneratorTests.cs+++ b/tests/Jellyfin.MediaEncoding.Hls.Tests/Playlist/DynamicHlsPlaylistGeneratorTests.cs@@ -53,7 +53,7 @@ namespace Jellyfin.MediaEncoding.Hls.Tests.PlaylistAssert.False(DynamicHlsPlaylistGenerator.IsExtractionAllowedForFile(filePath, allowedExtensions));}- private static TheoryData<int, long, double[]> ComputeEqualLengthSegments_Valid_Success_Data()+ public static TheoryData<int, long, double[]> ComputeEqualLengthSegments_Valid_Success_Data(){var data = new TheoryData<int, long, double[]>{@@ -67,7 +67,7 @@ namespace Jellyfin.MediaEncoding.Hls.Tests.Playlistreturn data;}- private static TheoryData<KeyframeData, int, double[]> ComputeSegments_Valid_Success_Data()+ public static TheoryData<KeyframeData, int, double[]> ComputeSegments_Valid_Success_Data(){var data = new TheoryData<KeyframeData, int, double[]>{diff --git a/tests/Jellyfin.MediaEncoding.Tests/Subtitles/SubtitleEncoderTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Subtitles/SubtitleEncoderTests.csindex 639c364df2..2431274383 100644--- a/tests/Jellyfin.MediaEncoding.Tests/Subtitles/SubtitleEncoderTests.cs+++ b/tests/Jellyfin.MediaEncoding.Tests/Subtitles/SubtitleEncoderTests.cs@@ -12,7 +12,7 @@ namespace Jellyfin.MediaEncoding.Subtitles.Tests{public class SubtitleEncoderTests{- internal static TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo> GetReadableFile_Valid_TestData()+ public static TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo> GetReadableFile_Valid_TestData(){var data = new TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo>();diff --git a/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs b/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.csindex 7c3a7ff6c7..a5bdb42d89 100644--- a/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs+++ b/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs@@ -7,7 +7,7 @@ namespace Jellyfin.Model.Drawing;public static class ImageFormatExtensionsTests{- private static TheoryData<ImageFormat> GetAllImageFormats()+ public static TheoryData<ImageFormat> GetAllImageFormats(){var theoryTypes = new TheoryData<ImageFormat>();foreach (var x in Enum.GetValues<ImageFormat>())diff --git a/tests/Jellyfin.Providers.Tests/Manager/ItemImageProviderTests.cs b/tests/Jellyfin.Providers.Tests/Manager/ItemImageProviderTests.csindex c0931dbcf1..08b343cd89 100644--- a/tests/Jellyfin.Providers.Tests/Manager/ItemImageProviderTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/ItemImageProviderTests.cs@@ -44,7 +44,7 @@ namespace Jellyfin.Providers.Tests.ManagerValidateImages_Test(ImageType.Primary, 0, true, 0, false, 0);}- private static TheoryData<ImageType, int> GetImageTypesWithCount()+ public static TheoryData<ImageType, int> GetImageTypesWithCount(){var theoryTypes = new TheoryData<ImageType, int>{diff --git a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.csindex b74b331b7f..28b2e1d8f2 100644--- a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs@@ -132,7 +132,7 @@ namespace Jellyfin.Providers.Tests.ManagerAssert.True(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, Array.Empty<string>(), null, true, out _));}- private static TheoryData<string, object, object> MergeBaseItemData_SimpleField_ReplacesAppropriately_TestData()+ public static TheoryData<string, object, object> MergeBaseItemData_SimpleField_ReplacesAppropriately_TestData()=> new(){{ "IndexNumber", 1, 2 },diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.csindex 91f61868b9..57674bb7f4 100644--- a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs@@ -209,7 +209,7 @@ public class MediaInfoResolverTestsAssert.Empty(streams);}- private static TheoryData<string, MediaStream[], MediaStream[]> GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly_Data()+ public static TheoryData<string, MediaStream[], MediaStream[]> GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly_Data(){var data = new TheoryData<string, MediaStream[], MediaStream[]>();diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.csindex 7e88cdb20f..6b2a052419 100644--- a/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.cs+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/VideoImageProviderTests.cs@@ -19,7 +19,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo{public class VideoImageProviderTests{- private static TheoryData<Video> GetImage_UnsupportedInput_ReturnsNoImage_TestData()+ public static TheoryData<Video> GetImage_UnsupportedInput_ReturnsNoImage_TestData(){return new(){diff --git a/tests/Jellyfin.Server.Implementations.Tests/Sorting/IndexNumberComparerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Sorting/IndexNumberComparerTests.csindex 1641618008..18588bd67a 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Sorting/IndexNumberComparerTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/Sorting/IndexNumberComparerTests.cs@@ -11,7 +11,7 @@ public class IndexNumberComparerTests{private readonly IBaseItemComparer _cmp = new IndexNumberComparer();- private static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData()+ public static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData()=> new(){{ null, new Audio() },diff --git a/tests/Jellyfin.Server.Implementations.Tests/Sorting/ParentIndexNumberComparerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Sorting/ParentIndexNumberComparerTests.csindex 7649e4df46..40f271d61b 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Sorting/ParentIndexNumberComparerTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/Sorting/ParentIndexNumberComparerTests.cs@@ -12,7 +12,7 @@ public class ParentIndexNumberComparerTests{private readonly IBaseItemComparer _cmp = new ParentIndexNumberComparer();- private static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData()+ public static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData()=> new(){{ null, new Audio() },diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/DashboardControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/DashboardControllerTests.csindex 0afb6f88da..52df1cd603 100644--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/DashboardControllerTests.cs+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/DashboardControllerTests.cs@@ -83,6 +83,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllersvar res = await response.Content.ReadAsStreamAsync();var data = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions);+ Assert.NotNull(data);Assert.Empty(data);}}diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/StartupControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/StartupControllerTests.csindex e72dacfe0f..0dd22644ac 100644--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/StartupControllerTests.cs+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/StartupControllerTests.cs@@ -62,7 +62,9 @@ namespace Jellyfin.Server.Integration.Tests.Controllersusing var contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);var user = await JsonSerializer.DeserializeAsync<StartupUserDto>(contentStream, _jsonOptions).ConfigureAwait(false);- Assert.NotEmpty(user!.Name);+ Assert.NotNull(user);+ Assert.NotNull(user.Name);+ Assert.NotEmpty(user.Name);Assert.Null(user.Password);}@@ -87,7 +89,9 @@ namespace Jellyfin.Server.Integration.Tests.Controllersvar contentStream = await getResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);var newUser = await JsonSerializer.DeserializeAsync<StartupUserDto>(contentStream, _jsonOptions).ConfigureAwait(false);- Assert.Equal(user.Name, newUser!.Name);+ Assert.NotNull(newUser);+ Assert.Equal(user.Name, newUser.Name);+ Assert.NotNull(newUser.Password);Assert.NotEmpty(newUser.Password);Assert.NotEqual(user.Password, newUser.Password);}diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.csindex 9d34c39a2b..2b825a93a0 100644--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/UserControllerTests.cs@@ -46,6 +46,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllersvar users = await JsonSerializer.DeserializeAsync<UserDto[]>(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), _jsonOpions).ConfigureAwait(false);// User are hidden by default+ Assert.NotNull(users);Assert.Empty(users);}@@ -60,6 +61,7 @@ namespace Jellyfin.Server.Integration.Tests.ControllersAssert.Equal(HttpStatusCode.OK, response.StatusCode);var users = await JsonSerializer.DeserializeAsync<UserDto[]>(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), _jsonOpions).ConfigureAwait(false);+ Assert.NotNull(users);Assert.Single(users);Assert.False(users![0].HasConfiguredPassword);}