public void LocalizerReturnsOriginalValuesIfTranslationDoesntExistAndMultiplePluraflFormsAreSpecified(string expected, int count)
        {
            SetupDictionary("en", new CultureDictionaryRecord[] { });
            var localizer = new PortableObjectStringLocalizer(new CultureInfo("en"), null, _localizationManager.Object, _logger.Object);

            var translation = localizer.Plural(count, new[] { "míč", "{0} míče", "{0} míčů" }, count);

            Assert.Equal(expected, translation);
        }
        public void LocalizerReturnsCorrectPluralFormIfMultiplePluraflFormsAreSpecified(string expected, int count)
        {
            SetupDictionary("en", new CultureDictionaryRecord[] {
                new CultureDictionaryRecord("míč", null, new[] { "ball", "{0} balls" })
            }, _enPluralRule);
            var localizer = new PortableObjectStringLocalizer(new CultureInfo("en"), null, _localizationManager.Object, _logger.Object);

            var translation = localizer.Plural(count, new[] { "míč", "{0} míče", "{0} míčů" }, count);

            Assert.Equal(expected, translation);
        }
        public void LocalizerReturnsOriginalTextForPluralIfTranslationDoesntExist(string expected, int count)
        {
            SetupDictionary("cs", new[] {
                new CultureDictionaryRecord("ball", null, new[] { "míč", "míče", "míčů" }),
            });
            var localizer = new PortableObjectStringLocalizer(new CultureInfo("cs"), null, _localizationManager.Object, _logger.Object);

            var translation = localizer.Plural(count, "car", "cars");

            Assert.Equal(expected, translation);
        }
        public void LocalizerReturnsTranslationInCorrectPluralForm(string expected, int count)
        {
            SetupDictionary("cs", new[] {
                new CultureDictionaryRecord("ball", null, new[] { "míč", "{0} míče", "{0} míčů" }),
            });
            var localizer = new PortableObjectStringLocalizer(new CultureInfo("cs"), null, _localizationManager.Object, _logger.Object);

            var translation = localizer.Plural(count, "ball", "{0} balls", count);

            Assert.Equal(expected, translation);
        }
        public void LocalizerReturnsCorrectTranslationForPluralIfNoPluralFormsSpecified(string culture, string expected, int count, string[] translations)
        {
            using (var cultureScope = CultureScope.Create(culture))
            {
                // using DefaultPluralRuleProvider to test it returns correct rule
                TryGetRuleFromDefaultPluralRuleProvider(cultureScope.UICulture, out var rule);
                Assert.NotNull(rule);

                SetupDictionary(culture, new[] { new CultureDictionaryRecord("ball", translations), }, rule);
                var localizer   = new PortableObjectStringLocalizer(null, _localizationManager.Object, true, _logger.Object);
                var translation = localizer.Plural(count, "ball", "{0} balls", count);

                Assert.Equal(expected, translation);
            }
        }