2021-11-02 20:12:13 +00:00
|
|
|
|
using MediaBrowser.Providers.Plugins.Tmdb;
|
2021-05-17 10:55:27 +00:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Jellyfin.Providers.Tests.Tmdb
|
|
|
|
|
{
|
|
|
|
|
public static class TmdbUtilsTests
|
|
|
|
|
{
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData("de", "de")]
|
|
|
|
|
[InlineData("En", "En")]
|
|
|
|
|
[InlineData("de-de", "de-DE")]
|
|
|
|
|
[InlineData("en-US", "en-US")]
|
|
|
|
|
[InlineData("de-CH", "de")]
|
|
|
|
|
public static void NormalizeLanguage_Valid_Success(string input, string expected)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(expected, TmdbUtils.NormalizeLanguage(input));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, null)]
|
|
|
|
|
[InlineData("", "")]
|
|
|
|
|
public static void NormalizeLanguage_Invalid_Equal(string? input, string? expected)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(expected, TmdbUtils.NormalizeLanguage(input!));
|
|
|
|
|
}
|
2021-10-21 22:35:14 +00:00
|
|
|
|
|
|
|
|
|
[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)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(expected, TmdbUtils.AdjustImageLanguage(imageLanguage, requestLanguage));
|
|
|
|
|
}
|
2021-05-17 10:55:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|