Esempio n. 1
0
        protected void                  AddChild(XmlNode parent, TestItem node)
        {
            //<TestModule/TestCase/Variation>
            string name = node.Type.ToString();

            //Create the Element
            TestXmlElement element = (TestXmlElement)_xmldoc.CreateElement(name);

            parent.AppendChild(element);

            //Add typed properties
            //TODO: Should these also be part of the properties collection, or not in the interface
            AddProperty(element, "Name", node.Name, 0);
            AddProperty(element, "Desc", node.Desc, 0);
            AddProperty(element, "Id", node.Order, 0);
//			AddProperty(element, "Guid",	node.Guid,		0);
            AddProperty(element, "Priority", node.Priority, 0);
            AddProperty(element, "Owner", node.Owner, 0);
            AddProperty(element, "Owners", node.Owners, TestPropertyFlags.MultipleValues);
            AddProperty(element, "Version", node.Version, 0);

            //Add extended properties
            AddProperties(element, node);

            //Add our own uniqueid (for fast assoication later)
            //Note: We place this 'userdata' into our own version of the XmlElement, (derived class)
            element.Item = node;

            //Recursure through the children
            foreach (TestItem childnode in node.Children)
            {
                this.AddChild(element, childnode);
            }
        }
Esempio n. 2
0
        protected TestItem                      FindMatchingNode(XmlNode xmlnode)
        {
            //Matching nodes are always elements (testmodule, testcase, variation)
            //Those nodes have item numbers...
            XmlNode parent = xmlnode;

            while (parent != null)
            {
                if (parent is TestXmlElement && ((TestXmlElement)parent).Item != null)
                {
                    break;
                }
                parent = parent.ParentNode;
            }

            //Note: We actually placed a uniqueid in the XmlElement node itself (derived node type)
            TestXmlElement found = parent as TestXmlElement;

            if (found != null)
            {
                return(found.Item);
            }

            //Otherwise, not found
            return(null);
        }