public void can_retrieve_a_child_element() { var child2 = theSource.GetChildrenElement("children", 2); var child1 = theSource.GetChildrenElement("children", 1); var child0 = theSource.GetChildrenElement("children", 0); child0.Set("a", 0); child1.Set("a", 1); child2.Set("a", 2); theSource.GetChildrenElement("children", 2).Set("b", 22); theDictionary.Children("children").ElementAt(0)["a"].ShouldEqual(0); theDictionary.Children("children").ElementAt(1)["a"].ShouldEqual(1); theDictionary.Children("children").ElementAt(2)["a"].ShouldEqual(2); theDictionary.Children("children").ElementAt(2)["b"].ShouldEqual(22); }
public void children() { theSource.GetChildrenElement("Children", 0).Set("A", 0); theSource.GetChildrenElement("Children", 1).Set("A", 1); theSource.GetChildrenElement("Children", 2).Set("A", 2); using (theMocks.Ordered()) { theReport.StartChild("Children", 0); theReport.Value("A", 0); theReport.EndChild(); theReport.StartChild("Children", 1); theReport.Value("A", 1); theReport.EndChild(); theReport.StartChild("Children", 2); theReport.Value("A", 2); theReport.EndChild(); } }
public SettingsData GetParentSource(SettingsData source) { ParentParts.Each(x => { if (x.Contains("[")) { var parts = x.TrimEnd(']').Split('['); var index = int.Parse(parts.Last()); source = source.GetChildrenElement(parts.First(), index); } else { source = source.Child(x); } }); return(source); }