aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs')
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
index 09e4709da..0a4a836cb 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Emby.Server.Implementations.Localization;
using MediaBrowser.Controller.Configuration;
@@ -127,6 +128,22 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
Assert.Equal(expectedLevel, level!);
}
+ [Theory]
+ [InlineData("0", 0)]
+ [InlineData("1", 1)]
+ [InlineData("6", 6)]
+ [InlineData("12", 12)]
+ [InlineData("42", 42)]
+ [InlineData("9999", 9999)]
+ public async Task GetRatingLevel_GivenValidAge_Success(string value, int expectedLevel)
+ {
+ var localizationManager = Setup(new ServerConfiguration { MetadataCountryCode = "nl" });
+ await localizationManager.LoadAll();
+ var level = localizationManager.GetRatingLevel(value);
+ Assert.NotNull(level);
+ Assert.Equal(expectedLevel, level);
+ }
+
[Fact]
public async Task GetRatingLevel_GivenUnratedString_Success()
{
@@ -142,6 +159,20 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
}
[Theory]
+ [InlineData("-NO RATING SHOWN-")]
+ [InlineData(":NO RATING SHOWN:")]
+ public async Task GetRatingLevel_Split_Success(string value)
+ {
+ var localizationManager = Setup(new ServerConfiguration()
+ {
+ UICulture = "en-US"
+ });
+ await localizationManager.LoadAll();
+
+ Assert.Null(localizationManager.GetRatingLevel(value));
+ }
+
+ [Theory]
[InlineData("Default", "Default")]
[InlineData("HeaderLiveTV", "Live TV")]
public void GetLocalizedString_Valid_Success(string key, string expected)