The Free Software Media System - Server Backend & API
Fix tests
Bond_0097bf831da62f0
diff --git a/tests/Jellyfin.Api.Tests/Controllers/ImageControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/ImageControllerTests.csindex 0254a1ec6e..5034ad3c71 100644--- a/tests/Jellyfin.Api.Tests/Controllers/ImageControllerTests.cs+++ b/tests/Jellyfin.Api.Tests/Controllers/ImageControllerTests.cs@@ -27,7 +27,7 @@ public static class ImageControllerTests[InlineData(null)][InlineData("")][InlineData("text/html")]- public static void TryGetImageExtensionFromContentType_InValid_False(string contentType)+ public static void TryGetImageExtensionFromContentType_InValid_False(string? contentType){Assert.False(ImageController.TryGetImageExtensionFromContentType(contentType, out var ex));Assert.Null(ex);diff --git a/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs b/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.csindex d46beedd99..95f9a5fcfb 100644--- a/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs+++ b/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs@@ -8,20 +8,18 @@ namespace Jellyfin.Extensions.Tests{public static TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>> CopyTo_Valid_Correct_TestData(){- var data = new TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>>();-- data.Add(- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 0, new[] { 0, 1, 2, 3, 4, 5 });-- data.Add(- new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 2, new[] { 5, 4, 0, 1, 2, 0 } );+ var data = new TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>>+ {+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 0, new[] { 0, 1, 2, 3, 4, 5 } },+ { new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 2, new[] { 5, 4, 0, 1, 2, 0 } }+ };return data;}[Theory][MemberData(nameof(CopyTo_Valid_Correct_TestData))]- public static void CopyTo_Valid_Correct<T>(IReadOnlyList<T> source, IList<T> destination, int index, IList<T> expected)+ public static void CopyTo_Valid_Correct(IReadOnlyList<int> source, IList<int> destination, int index, IList<int> expected){source.CopyTo(destination, index);Assert.Equal(expected, destination);@@ -29,29 +27,21 @@ namespace Jellyfin.Extensions.Testspublic static TheoryData<IReadOnlyList<int>, IList<int>, int> CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData(){- var data = new TheoryData<IReadOnlyList<int>, IList<int>, int>();-- data.Add(- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, -1 );-- data.Add(- new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 6 );-- data.Add(- new[] { 0, 1, 2 }, Array.Empty<int>(), 0 );-- data.Add(- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0 }, 0 );-- data.Add(- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 1 );+ var data = new TheoryData<IReadOnlyList<int>, IList<int>, int>+ {+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, -1 },+ { new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 6 },+ { new[] { 0, 1, 2 }, Array.Empty<int>(), 0 },+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0 }, 0 },+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 1 }+ };return data;}[Theory][MemberData(nameof(CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData))]- public static void CopyTo_Invalid_ThrowsArgumentOutOfRangeException<T>(IReadOnlyList<T> source, IList<T> destination, int index)+ public static void CopyTo_Invalid_ThrowsArgumentOutOfRangeException(IReadOnlyList<int> source, IList<int> destination, int index){Assert.Throws<ArgumentOutOfRangeException>(() => source.CopyTo(destination, index));}diff --git a/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs b/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.csindex d39a22e30b..f4c0d9fe8f 100644--- a/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs+++ b/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs@@ -192,7 +192,7 @@ namespace Jellyfin.Model.Tests.Entities[InlineData(4090, 3070, false, "4K")][InlineData(7680, 4320, false, "8K")][InlineData(8190, 6140, false, "8K")]- public void GetResolutionText_Valid(int? width, int? height, bool interlaced, string expected)+ public void GetResolutionText_Valid(int? width, int? height, bool interlaced, string? expected){var mediaStream = new MediaStream(){diff --git a/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs b/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.csindex 62d60e5a4b..5029a87933 100644--- a/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs@@ -52,9 +52,8 @@ namespace Jellyfin.Naming.Tests.Video[InlineData("My Movie 2013-12-09", "My Movie 2013-12-09", null)][InlineData("My Movie 20131209", "My Movie 20131209", null)][InlineData("My Movie 2013-12-09 2013", "My Movie 2013-12-09", 2013)]- [InlineData(null, null, null)][InlineData("", "", null)]- public void CleanDateTimeTest(string input, string expectedName, int? expectedYear)+ public void CleanDateTimeTest(string input, string? expectedName, int? expectedYear){input = Path.GetFileName(input);diff --git a/tests/Jellyfin.Networking.Tests/Configuration/NetworkConfigurationTests.cs b/tests/Jellyfin.Networking.Tests/Configuration/NetworkConfigurationTests.csindex 30726f1d3c..f337fe20b8 100644--- a/tests/Jellyfin.Networking.Tests/Configuration/NetworkConfigurationTests.cs+++ b/tests/Jellyfin.Networking.Tests/Configuration/NetworkConfigurationTests.cs@@ -6,7 +6,6 @@ namespace Jellyfin.Networking.Tests.Configuration;public static class NetworkConfigurationTests{[Theory]- [InlineData("", null)][InlineData("", "")][InlineData("/Test", "/Test")][InlineData("/Test", "Test")]diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.csindex 2bc686a337..85963e5def 100644--- a/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.cs+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/EmbeddedImageProviderTests.cs@@ -55,7 +55,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo[InlineData("clearlogo.png", null, 1, ImageType.Logo, ImageFormat.Png)] // extract extension from name[InlineData("backdrop", "image/bmp", 2, ImageType.Backdrop, ImageFormat.Bmp)] // extract extension from mimetype[InlineData("poster", null, 3, ImageType.Primary, ImageFormat.Jpg)] // default extension to jpg- public async void GetImage_Attachment_ReturnsCorrectSelection(string filename, string mimetype, int targetIndex, ImageType type, ImageFormat? expectedFormat)+ public async void GetImage_Attachment_ReturnsCorrectSelection(string filename, string? mimetype, int targetIndex, ImageType type, ImageFormat? expectedFormat){var attachments = new List<MediaAttachment>();string pathPrefix = "path";@@ -103,7 +103,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo[InlineData(null, "mjpeg", 1, ImageType.Primary, ImageFormat.Jpg)][InlineData(null, "png", 1, ImageType.Primary, ImageFormat.Png)][InlineData(null, "webp", 1, ImageType.Primary, ImageFormat.Webp)]- public async void GetImage_Embedded_ReturnsCorrectSelection(string label, string? codec, int targetIndex, ImageType type, ImageFormat? expectedFormat)+ public async void GetImage_Embedded_ReturnsCorrectSelection(string? label, string? codec, int targetIndex, ImageType type, ImageFormat? expectedFormat){var streams = new List<MediaStream>();for (int i = 1; i <= targetIndex; i++)diff --git a/tests/Jellyfin.Providers.Tests/Tmdb/TmdbUtilsTests.cs b/tests/Jellyfin.Providers.Tests/Tmdb/TmdbUtilsTests.csindex efd2d9553f..0bfa330cb6 100644--- a/tests/Jellyfin.Providers.Tests/Tmdb/TmdbUtilsTests.cs+++ b/tests/Jellyfin.Providers.Tests/Tmdb/TmdbUtilsTests.cs@@ -25,14 +25,11 @@ namespace Jellyfin.Providers.Tests.Tmdb}[Theory]- [InlineData(null, null, null)]- [InlineData(null, "en-US", null)]- [InlineData("en", null, "en")][InlineData("en", "en-US", "en-US")][InlineData("fr-CA", "fr-BE", "fr-CA")][InlineData("fr-CA", "fr", "fr-CA")][InlineData("de", "en-US", "de")]- public static void AdjustImageLanguage_Valid_Success(string imageLanguage, string requestLanguage, string expected)+ public static void AdjustImageLanguage_Valid_Success(string imageLanguage, string requestLanguage, string? expected){Assert.Equal(expected, TmdbUtils.AdjustImageLanguage(imageLanguage, requestLanguage));}diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.csindex 1c35eb3f50..d1be07aa22 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs@@ -83,7 +83,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library[InlineData(@"\home/jeff\myfile.mkv", '\\', @"\home\jeff\myfile.mkv")][InlineData(@"\home/jeff\myfile.mkv", '/', "/home/jeff/myfile.mkv")][InlineData("", '/', "")]- public void NormalizePath_SpecifyingSeparator_Normalizes(string path, char separator, string expectedPath)+ public void NormalizePath_SpecifyingSeparator_Normalizes(string? path, char separator, string? expectedPath){Assert.Equal(expectedPath, path.NormalizePath(separator));}diff --git a/tests/Jellyfin.Server.Implementations.Tests/QuickConnect/QuickConnectManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/QuickConnect/QuickConnectManagerTests.csindex c32d89ea5d..30f72f5957 100644--- a/tests/Jellyfin.Server.Implementations.Tests/QuickConnect/QuickConnectManagerTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/QuickConnect/QuickConnectManagerTests.cs@@ -85,10 +85,10 @@ namespace Jellyfin.Server.Implementations.Tests.QuickConnect}[Fact]- public void AuthorizeRequest_QuickConnectUnavailable_ThrowsAuthenticationException()+ public async Task AuthorizeRequest_QuickConnectUnavailable_ThrowsAuthenticationException(){_config.QuickConnectAvailable = false;- Assert.ThrowsAsync<AuthenticationException>(() => _quickConnectManager.AuthorizeRequest(Guid.Empty, string.Empty));+ await Assert.ThrowsAsync<AuthenticationException>(() => _quickConnectManager.AuthorizeRequest(Guid.Empty, string.Empty));}[Fact]diff --git a/tests/Jellyfin.Server.Implementations.Tests/SessionManager/SessionManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/SessionManager/SessionManagerTests.csindex ebd3a3891c..e463d838e6 100644--- a/tests/Jellyfin.Server.Implementations.Tests/SessionManager/SessionManagerTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/SessionManager/SessionManagerTests.cs@@ -21,7 +21,7 @@ public class SessionManagerTests[Theory][InlineData("", typeof(ArgumentException))][InlineData(null, typeof(ArgumentNullException))]- public async Task GetAuthorizationToken_Should_ThrowException(string deviceId, Type exceptionType)+ public async Task GetAuthorizationToken_Should_ThrowException(string? deviceId, Type exceptionType){await using var sessionManager = new Emby.Server.Implementations.Session.SessionManager(NullLogger<Emby.Server.Implementations.Session.SessionManager>.Instance,