Solution layout, build rules with zero-package guard, in-house test framework, localization runtime, brand mark rasteriser with ICO/PNG generation, Core contracts (imaging, video, domain model, TIFF reader), Titano.Tools (make-icon, i18n, xaml-lint, package-guard) and docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using System.Globalization;
|
|
using Titano.Core.Localization;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.Core.Tests.Localization;
|
|
|
|
public sealed class PluralRulesTests
|
|
{
|
|
[Theory]
|
|
[Case("en", 1L, PluralCategory.One)]
|
|
[Case("en", 0L, PluralCategory.Other)]
|
|
[Case("fr", 0L, PluralCategory.One)]
|
|
[Case("ru", 21L, PluralCategory.One)]
|
|
[Case("ru", 22L, PluralCategory.Few)]
|
|
[Case("ru", 11L, PluralCategory.Many)]
|
|
[Case("ru", 25L, PluralCategory.Many)]
|
|
[Case("pl", 12L, PluralCategory.Many)]
|
|
[Case("pl", 23L, PluralCategory.Few)]
|
|
[Case("cs", 3L, PluralCategory.Few)]
|
|
[Case("ja", 1L, PluralCategory.Other)]
|
|
[Case("ar", 11L, PluralCategory.Many)]
|
|
public void SelectsCldrCategory(string culture, long count, PluralCategory expected) =>
|
|
Assert.Equal(expected, PluralRules.Select(CultureInfo.GetCultureInfo(culture), count));
|
|
|
|
[Test]
|
|
public void BestMatchFallsBackToEnglish()
|
|
{
|
|
Assert.Equal("it", Languages.BestMatch(CultureInfo.GetCultureInfo("it-CH")).Name);
|
|
Assert.Equal("pt-BR", Languages.BestMatch(CultureInfo.GetCultureInfo("pt-BR")).Name);
|
|
Assert.Equal("en", Languages.BestMatch(CultureInfo.GetCultureInfo("sw")).Name);
|
|
}
|
|
|
|
[Test]
|
|
public void EveryShippedLanguageIsAKnownCulture()
|
|
{
|
|
foreach (var code in Languages.Shipped) Assert.NotNull(CultureInfo.GetCultureInfo(code));
|
|
}
|
|
}
|