aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2020-04-20 10:16:22 +0200
committerBond_009 <bond.009@outlook.com>2020-04-20 10:18:12 +0200
commit958681cdffddc7ea24d92d126badb3372cfa5d41 (patch)
treee66c2788b7222995179c08cbff49410587d43072 /tests/Jellyfin.Server.Implementations.Tests
parent7f4a229cd2fee89fdd8329c9c9f907e381d45c46 (diff)
Cover more branches
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests')
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.cs6
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs12
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.cs b/tests/Jellyfin.Server.Implementations.Tests/HttpServer/ResponseFilterTests.cs
index 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.cs
index 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));
+ }
}
}