Ejemplo n.º 1
0
        public void SplitCultureCodePartsTest(string value, string expectedLanguageCode, string expectedLocaleCode)
        {
            var actual = CultureInfoHelper.SplitCultureCodeParts(value);

            Assert.Equal(expectedLanguageCode, actual.languageCode);
            Assert.Equal(expectedLocaleCode, actual.localeCode);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PlatformCultureInfo"/> class.
        /// Container for culture info parts
        /// </summary>
        /// <param name="cultureCode">
        /// </param>
        /// <exception cref="ArgumentException">
        /// If
        /// <exception cref="cultureCode">
        /// is null or string.Empty
        /// </exception>
        /// </exception>
        public PlatformCultureInfo(string cultureCode)
        {
            if (string.IsNullOrEmpty(cultureCode))
            {
                throw new ArgumentException("Expected culture identifier", nameof(cultureCode));
            }

            var(languageCode, localeCode) = CultureInfoHelper.SplitCultureCodeParts(cultureCode);

            LanguageCode = languageCode;
            LocaleCode   = localeCode;
        }