The Free Software Media System - Server Backend & API
Cover more branches
Bond_009958681cdffdd
diff --git a/tests/Jellyfin.Common.Tests/Extensions/StringExtensionsTests.cs b/tests/Jellyfin.Common.Tests/Extensions/StringExtensionsTests.csindex 89e7e8fde2..0ed7673fdb 100644--- a/tests/Jellyfin.Common.Tests/Extensions/StringExtensionsTests.cs+++ b/tests/Jellyfin.Common.Tests/Extensions/StringExtensionsTests.cs@@ -9,7 +9,7 @@ namespace Jellyfin.Common.Tests.Extensions[Theory][InlineData("Banana split", ' ', "Banana")][InlineData("Banana split", 'q', "Banana split")]- public void LeftPartCharTest(string str, char needle, string result)+ public void LeftPart_ValidArgsCharNeedle_Correct(string str, char needle, string result){Assert.Equal(result, str.AsSpan().LeftPart(needle).ToString());}@@ -17,7 +17,7 @@ namespace Jellyfin.Common.Tests.Extensions[Theory][InlineData("Banana split", " ", "Banana")][InlineData("Banana split test", " split", "Banana")]- public void LeftPartWithoutStringComparisonTest(string str, string needle, string result)+ public void LeftPart_ValidArgsWithoutStringComparison_Correct(string str, string needle, string result){Assert.Equal(result, str.AsSpan().LeftPart(needle).ToString());}@@ -27,7 +27,7 @@ namespace Jellyfin.Common.Tests.Extensions[InlineData("Banana split test", " split", StringComparison.Ordinal, "Banana")][InlineData("Banana split test", " Split", StringComparison.Ordinal, "Banana split test")][InlineData("Banana split test", " Splït", StringComparison.InvariantCultureIgnoreCase, "Banana split test")]- public void LeftPartTest(string str, string needle, StringComparison stringComparison, string result)+ public void LeftPart_ValidArgs_Correct(string str, string needle, StringComparison stringComparison, string result){Assert.Equal(result, str.AsSpan().LeftPart(needle, stringComparison).ToString());}diff --git a/tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.cs b/tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.csindex 42d128dc68..39bd94b598 100644--- a/tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.cs@@ -3,12 +3,14 @@ using Xunit;namespace Jellyfin.Server.Implementations.Tests.HttpServer{- public class HttpServerTests+ public class ResponseFilterTests{[Theory]+ [InlineData(null, null)]+ [InlineData("", "")][InlineData("This is a clean string.", "This is a clean string.")][InlineData("This isn't \n\ra clean string.", "This isn't a clean string.")]- public void RemoveControlCharactersTest(string input, string result)+ public void RemoveControlCharacters_ValidArgs_Correct(string? input, string? result){Assert.Equal(result, ResponseFilter.RemoveControlCharacters(input));}diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.csindex 7053ed3297..d2ed0d9257 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs@@ -1,3 +1,4 @@+using System;using Emby.Server.Implementations.Library;using Xunit;@@ -9,9 +10,18 @@ namespace Jellyfin.Server.Implementations.Tests.Library[InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")][InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")][InlineData("Superman: Red Son", "imdbid", null)]- public void GetAttributeValueTest(string input, string attribute, string? result)+ public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? result){Assert.Equal(result, PathExtensions.GetAttributeValue(input, attribute));}++ [Theory]+ [InlineData("", "")]+ [InlineData("Superman: Red Son [imdbid=tt10985510]", "")]+ [InlineData("", "imdbid")]+ public void GetAttributeValue_EmptyString_ThrowsArgumentException(string input, string attribute)+ {+ Assert.Throws<ArgumentException>(() => PathExtensions.GetAttributeValue(input, attribute));+ }}}