예제 #1
0
        public void TestSplitLocale_NullLocale_ShouldReturnDefaultLanguageCountryCode()
        {
            string inputLocale = null;
            string languageCode;
            string countryCode;

            TranslationUtils.SplitLocale(inputLocale, out languageCode, out countryCode);

            Assert.AreEqual(languageCode, "en", "Invalid language code returned");
            Assert.AreEqual(countryCode, "US", "Invalid country code returned");
        }
예제 #2
0
        public void TestSplitLocale_ValidLocale_ShouldReturnValidLanguageCountryCode()
        {
            string inputLanguageCode = "XY";
            string inputCountryCode  = "ab";
            string inputlocale       = $"{inputLanguageCode}-{inputCountryCode}";
            string languageCode;
            string countryCode;

            TranslationUtils.SplitLocale(inputlocale, out languageCode, out countryCode);

            Assert.AreEqual(languageCode, inputLanguageCode.ToLower(), "Invalid language code returned");
            Assert.AreEqual(countryCode, inputCountryCode.ToUpper(), "Invalid country code returned");
        }