Exemple #1
0
            public void 無限ループするのでRootと同じIDは設定できません()
            {
                XMLMaker maker = new XMLMaker("root", "root");

                maker["root"] = new XmlMaterial("child", "root");
                XmlDocument a = maker.Xml;
            }
Exemple #2
0
            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));
            }
Exemple #3
0
        public string Add(XmlMaterial child)
        {
            Random rnd = new Random();
            string key;

            while (true)
            {
                key = rnd.Next(100000).ToString();
                if (!_materials.ContainsKey(key))
                {
                    break;
                }
            }

            _materials[key] = child;
            return(key);
        }