public void get_child_when_it_already_exists() { var child = new Dictionary <string, object>(); theDictionary.Add("a", "something"); theDictionary.Add("child", child); child.Add("abc", 123); var childValueSource = theSource.As <IValueSource>().GetChild("child"); childValueSource.Get("abc").ShouldEqual(123); }
public void load_several_levels_of_nested_properties() { var source = new SettingsData(new Dictionary <string, object>(), "some name"); source["A"] = 1; source["B"] = 2; source["Child.A"] = 2; source["Child.B"] = 3; source["Child.Nested.A"] = 4; source["Child.Nested.B"] = 5; source.Get("A").ShouldEqual(1); source.Get("B").ShouldEqual(2); source.As <IValueSource>().GetChild("Child").Get("A").ShouldEqual(2); source.As <IValueSource>().GetChild("Child").Get("B").ShouldEqual(3); source.As <IValueSource>().GetChild("Child").GetChild("Nested").Get("A").ShouldEqual(4); source.As <IValueSource>().GetChild("Child").GetChild("Nested").Get("B").ShouldEqual(5); }