public void GetSettings_NoSettingsFromSections() { string json = "{ \"a.Value\": true, \"b.Value\": false }"; var sections = new [] { "d" }; var settings = LanguageClientConfigurationSettingsProvider.GetSettings(sections, json); Assert.IsNull(settings); }
public void GetSettings_OneSettingFromDifferentSection() { string json = "{ \"a.Value-a\": true, \"b.Value-b\": false }"; var sections = new [] { "a" }; var settings = LanguageClientConfigurationSettingsProvider.GetSettings(sections, json); var aObject = settings.GetValue("a") as JObject; var bObject = settings.GetValue("b"); var value = aObject.GetValue("Value-a") as JValue; Assert.IsNull(bObject); Assert.AreEqual(true, value.Value); }
public void GetSettings_UseEmbeddedResourceAsDefault_UserDefinedJsonOverridesSomeValues() { string json = "{ \"Test.Value2\": \"changed\" }"; var sections = new [] { "Test" }; var settings = LanguageClientConfigurationSettingsProvider.GetSettings( GetType(), sections, json); var obj = settings.GetValue("Test") as JObject; var value1 = obj.GetValue("Value1") as JValue; var value2 = obj.GetValue("Value2") as JValue; Assert.AreEqual(true, value1.Value); Assert.AreEqual("changed", value2.Value); }