public void 無限ループするのでRootと同じIDは設定できません() { XMLMaker maker = new XMLMaker("root", "root"); maker["root"] = new XmlMaterial("child", "root"); XmlDocument a = maker.Xml; }
public void Rootの属性を設定できます() { XMLMaker maker = new XMLMaker("root"); maker.RootAttrs["name"] = "ルート"; maker.RootAttrs["code"] = "コード"; Assert.That(maker.Xml.InnerXml, Is.EqualTo("<root name=\"ルート\" code=\"コード\" />")); }
public void Addもできます() { XMLMaker maker = new XMLMaker("root"); string key = maker.Add(new XmlMaterial("child1")); Assert.That(maker.Xml.InnerXml, Is.EqualTo(SIMPLE_XML)); maker[key].Attrs["hogehoge"] = "100"; Assert.That(maker.Xml.InnerXml, Is.EqualTo(ATTRIBUTE_XML)); maker.Add(new XmlMaterial("child2", key)); key = maker.Add(new XmlMaterial("child3")); maker[key].Attrs["hogehoge"] = "100"; Assert.That(maker.Xml.InnerXml, Is.EqualTo(GRANDCHILD_XML)); }
public void Dictionaryぽく使えます() { XMLMaker maker = new XMLMaker("root"); maker["1"] = new XmlMaterial("child1"); Assert.That(maker.Xml.InnerXml, Is.EqualTo(SIMPLE_XML)); maker["1"].Attrs["hogehoge"] = "100"; Assert.That(maker.Xml.InnerXml, Is.EqualTo(ATTRIBUTE_XML)); maker["2"] = new XmlMaterial("child2", "1"); maker["3"] = new XmlMaterial("child3"); maker["3"].Attrs["hogehoge"] = "100"; Assert.That(maker.Xml.InnerXml, Is.EqualTo(GRANDCHILD_XML)); }