public void Pluralize(double n, string expected)
        {
            var subject = new PluralFormatter();
            var args    = new Dictionary <string, object> {
                { "test", n }
            };
            var arguments =
                new ParsedArguments(
                    new[]
            {
                new KeyedBlock("zero", "nothing"),
                new KeyedBlock("one", "just one"),
                new KeyedBlock("other", "wow")
            },
                    new FormatterExtension[0]);
            var request = new FormatterRequest(new Literal(1, 1, 1, 1, new StringBuilder()), "test", "plural", null);
            var actual  = subject.Pluralize("en", arguments, Convert.ToDouble(args[request.Variable]), 0);

            Assert.Equal(expected, actual);
        }
Пример #2
0
        private void UpdateComputersCount()
        {
            if (tableModel.Rows.Count == 0)
            {
                resultsGroupBox.Text = Properties.Resources.searchResultGroupBox_Text;
                return;
            }

            PluralFormatter formatter = new PluralFormatter();
            resultsGroupBox.Text =
                formatter.Format(tableModel.Rows.Count,
                    "computerSearch_Found", false) +
                formatter.Format(tableModel.Rows.Count,
                    "computerSearch_computer") + ":";
        }