/// <summary>
 /// Tests the one form language.
 /// Families: Asian (Chinese, Japanese, Korean), Persian, Turkic/Altaic (Turkish), Thai, Lao, Indonesian,
 ///
 /// Also used with: Georgian
 /// </summary>
 void TestOneFormLanguage(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 0));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 9001));
 }
 /// <summary>
 /// Tests the two form language for Romanic (French, Brazilian Portuguese) languages
 /// </summary>
 void TestTwoFormLanguageFrenchAndBrazilianPortugueseAndTurkish(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 0));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 5555));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 356));
 }
 void TestThreeFormSlavicCzechSlovakia(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 4));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 500));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 9001));
 }
 void TestThreeFormBalticLatvia(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 21));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 31));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 500));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 11));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 0));
 }
 void TestThreeFormSlavicMacedonia(string languageCode)
 {
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 11));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 22));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 500));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 9055));
 }
 void TestTwoFormIcelandic(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 21));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 31));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 11));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 678));
 }
        public void TestPlural_UnknownLanguage()
        {
            var languageCode = "unknown";

            Assert.AreEqual(baseKey, PluralForms.GetPluralKey(languageCode, baseKey, 1));
            Assert.AreNotEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
            Assert.AreNotEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 21));
            Assert.AreNotEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 21));
        }
 void TestThreeFormPolish(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 84));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 12));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 14));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 506));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 56));
 }
 public void TestPlural_ro()
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey("ro", baseKey, 1));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey("ro", baseKey, 0));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey("ro", baseKey, 2));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey("ro", baseKey, 19));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey("ro", baseKey, 109));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey("ro", baseKey, 37));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey("ro", baseKey, 59));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey("ro", baseKey, 66));
 }
 /// <summary>
 /// Tests the four form slavic languages
 /// Families: Slavic (Slovenian, Sorbian)
 /// </summary>
 void TestFourFormSlavic(string languageCode)
 {
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 101));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 102));
     Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(languageCode, baseKey, 3));
     Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(languageCode, baseKey, 103));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 5));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 5555));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 9006));
 }
 /// <summary>
 /// Tests the three form slavic.
 /// Slavic (Belarusian, Bosnian, Croatian, Serbian, Russian, Ukrainian)
 /// </summary>
 void TestThreeFormSlavic(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 21));
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 121));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 23));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 92));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 144));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 11));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 36));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 75));
 }
 void TestArabic(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 0));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(languageCode, baseKey, 2));
     Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(languageCode, baseKey, 3));
     Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(languageCode, baseKey, 203));
     Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(languageCode, baseKey, 107));
     Assert.AreEqual(baseKeyFour, PluralForms.GetPluralKey(languageCode, baseKey, 11));
     Assert.AreEqual(baseKeyFour, PluralForms.GetPluralKey(languageCode, baseKey, 33));
     Assert.AreEqual(baseKeyFive, PluralForms.GetPluralKey(languageCode, baseKey, 100));
     Assert.AreEqual(baseKeyFive, PluralForms.GetPluralKey(languageCode, baseKey, 202));
 }
        public void TestPlural_CustomAlgorithm()
        {
            Func <int, int> customAlgorithm = (n) => n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;

            Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(baseKey, 0, customAlgorithm));
            Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(baseKey, 1, customAlgorithm));
            Assert.AreEqual(baseKeyTwo, PluralForms.GetPluralKey(baseKey, 2, customAlgorithm));
            Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(baseKey, 3, customAlgorithm));
            Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(baseKey, 203, customAlgorithm));
            Assert.AreEqual(baseKeyThree, PluralForms.GetPluralKey(baseKey, 107, customAlgorithm));
            Assert.AreEqual(baseKeyFour, PluralForms.GetPluralKey(baseKey, 11, customAlgorithm));
            Assert.AreEqual(baseKeyFour, PluralForms.GetPluralKey(baseKey, 33, customAlgorithm));
            Assert.AreEqual(baseKeyFive, PluralForms.GetPluralKey(baseKey, 100, customAlgorithm));
            Assert.AreEqual(baseKeyFive, PluralForms.GetPluralKey(baseKey, 202, customAlgorithm));
        }
 /// <summary>
 /// Tests the two form language.
 /// Families: Germanic (Danish, Dutch, English, Faroese, Frisian, German, Norwegian, Swedish),
 /// Finno-Ugric (Estonian, Finnish, Hungarian), Language isolate (Basque),
 /// Latin/Greek (Greek), Semitic (Hebrew), Romanic (Italian, Portuguese, Spanish, Catalan), Vietnamese
 ///
 /// Note: also using this for Bulgarian, Armenian, Afrikaans
 /// </summary>
 void TestTwoFormLanguage(string languageCode)
 {
     Assert.AreEqual(baseKeyZero, PluralForms.GetPluralKey(languageCode, baseKey, 1));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 0));
     Assert.AreEqual(baseKeyOne, PluralForms.GetPluralKey(languageCode, baseKey, 5555));
 }