public void TestSet() { var dictionary = new LocalizableStringCollection { "neutralValue", { "de-DE", "germanyValue" }, // Intential duplicates (should be removed) "neutralValue", { "de-DE", "germanyValue" } }; dictionary.Set(LocalizableString.DefaultLanguage, "neutralValue2"); dictionary.Set(new CultureInfo("de-DE"), "germanyValue2"); dictionary.GetExactLanguage(LocalizableString.DefaultLanguage).Should().Be("neutralValue2"); dictionary.GetExactLanguage(new CultureInfo("de-DE")).Should().Be("germanyValue2"); }
public void TestGetExactLanguage() { var dictionary = new LocalizableStringCollection { "neutralValue", { "en-US", "americaValue" }, { "en-GB", "gbValue" }, { "de", "germanValue" }, { "de-DE", "germanyValue" } }; dictionary.GetExactLanguage(LocalizableString.DefaultLanguage).Should().Be("neutralValue", because: "Unspecified language should default to English generic"); dictionary.GetExactLanguage(new CultureInfo("en-US")).Should().Be("americaValue"); dictionary.GetExactLanguage(new CultureInfo("en-CA")).Should().BeNull(); dictionary.GetExactLanguage(new CultureInfo("en-GB")).Should().Be("gbValue"); dictionary.GetExactLanguage(new CultureInfo("de")).Should().Be("germanValue"); dictionary.GetExactLanguage(new CultureInfo("de-DE")).Should().Be("germanyValue"); dictionary.GetExactLanguage(new CultureInfo("de-AT")).Should().BeNull(); }