diff --git a/tests/Jellyfin.Api.Tests/Controllers/ImageControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/ImageControllerTests.cs index 0254a1ec6..5034ad3c7 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.cs index d46beedd9..95f9a5fcf 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, IList, int, IList> CopyTo_Valid_Correct_TestData() { - var data = new TheoryData, IList, int, IList>(); - - 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, IList, int, IList> + { + { 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(IReadOnlyList source, IList destination, int index, IList expected) + public static void CopyTo_Valid_Correct(IReadOnlyList source, IList destination, int index, IList expected) { source.CopyTo(destination, index); Assert.Equal(expected, destination); @@ -29,29 +27,21 @@ namespace Jellyfin.Extensions.Tests public static TheoryData, IList, int> CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData() { - var data = new TheoryData, IList, 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(), 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, IList, 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(), 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(IReadOnlyList source, IList destination, int index) + public static void CopyTo_Invalid_ThrowsArgumentOutOfRangeException(IReadOnlyList source, IList destination, int index) { Assert.Throws(() => source.CopyTo(destination, index)); } diff --git a/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs b/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs index d39a22e30..f4c0d9fe8 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.cs index 62d60e5a4..5029a8793 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.cs index 30726f1d3..f337fe20b 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.cs index 2bc686a33..85963e5de 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(); 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(); for (int i = 1; i <= targetIndex; i++) diff --git a/tests/Jellyfin.Providers.Tests/Tmdb/TmdbUtilsTests.cs b/tests/Jellyfin.Providers.Tests/Tmdb/TmdbUtilsTests.cs index efd2d9553..0bfa330cb 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.cs index 1c35eb3f5..d1be07aa2 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.cs index c32d89ea5..30f72f595 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(() => _quickConnectManager.AuthorizeRequest(Guid.Empty, string.Empty)); + await Assert.ThrowsAsync(() => _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.cs index ebd3a3891..e463d838e 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.Instance,