mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-18 13:40:45 +01:00
@@ -0,0 +1,18 @@
|
||||
using Emby.Server.Implementations.HttpServer;
|
||||
using Xunit;
|
||||
|
||||
namespace Jellyfin.Server.Implementations.Tests.HttpServer
|
||||
{
|
||||
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 RemoveControlCharacters_ValidArgs_Correct(string? input, string? result)
|
||||
{
|
||||
Assert.Equal(result, ResponseFilter.RemoveControlCharacters(input));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Emby.Server.Implementations.Library;
|
||||
using Xunit;
|
||||
|
||||
namespace Jellyfin.Server.Implementations.Tests.Library
|
||||
{
|
||||
public class PathExtensionsTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")]
|
||||
[InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")]
|
||||
[InlineData("Superman: Red Son", "imdbid", null)]
|
||||
public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? expectedResult)
|
||||
{
|
||||
Assert.Equal(expectedResult, 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user