public void Accept_Language()
        {
            StringWithQualityHeaderValue[] header = new StringWithQualityHeaderValue[] {
                new StringWithQualityHeaderValue("fr", 1.0),
                new StringWithQualityHeaderValue("de", 0.5)
            };

            Assert.AreEqual("fr", header.TryGetCultureFromAcceptLanguage(LocalizationContext.Cultures).TwoLetterISOLanguageName);
        }
Пример #2
0
        public void Accept_Language_From_System_Culture()
        {
            //TODO: test null or empty list?

            CultureInfo[] cultures = new CultureInfo[] { new CultureInfo("de-CH"), new CultureInfo("fr-CH") };

            StringWithQualityHeaderValue[] header = new StringWithQualityHeaderValue[] {
                new StringWithQualityHeaderValue("fr", 1.0),
                new StringWithQualityHeaderValue("de", 0.5)
            };

            Assert.AreEqual("fr", header.TryGetCultureFromAcceptLanguage(cultures).TwoLetterISOLanguageName);
        }