public void ReadXml(XmlReader reader)
        {
            base.ReadXmlAttributes(reader);

            reader.MoveToElement();
            bool empty = reader.IsEmptyElement;

            reader.ReadStartElement(Xml.TestSuite);

            if (!empty)
            {
                reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);

                while (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == Xml.TestSuite)
                    {
                        new TestSuite(null, this).ReadXml(reader);
                    }
                    else if (reader.Name == TestCase.Xml.TestCase)
                    {
                        new TestCase(null, this).ReadXml(reader);
                    }

                    reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);
                }

                reader.ReadEndElement();
            }
        }
Esempio n. 2
0
        public void ReadXml(XmlReader reader)
        {
            Utility.Code.Require(reader, "reader");

            string extension = reader.GetAttribute(Xml.Type);

            if (!string.IsNullOrEmpty(extension))
            {
                this.ExtensionType = new Regex(extension);
            }

            reader.ReadStartElement();

            reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);

            this.ExecutionCommandLine = CommandLine.FromString(reader.ReadElementString(Xml.ExecutionCommandLine));

            reader.ReadEndElement();
        }
        public void ReadXml(XmlReader reader)
        {
            Utility.Code.Require(reader, "reader");

            string extension = reader.GetAttribute(Xml.Type);

            if (!string.IsNullOrEmpty(extension))
            {
                this.ExtensionType = new Regex(extension);
            }

            reader.ReadStartElement();

            reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);

            string name = reader.Name;

            if ((name == Xml.DiscoveryCommandLine) || (name == Xml.DiscoveryFileMap))
            {
                this.DiscoveryMethodType = (DiscoveryMethodType)Enum.Parse(typeof(DiscoveryMethodType), name);

                bool empty = reader.IsEmptyElement;

                reader.ReadStartElement();
                if (name == Xml.DiscoveryCommandLine)
                {
                    empty = false;
                    this.DiscoveryCommandLine = CommandLine.FromString(reader.ReadString());
                }
                else if (name == Xml.DiscoveryFileMap)
                {
                    reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);
                    while (reader.NodeType == XmlNodeType.Element)
                    {
                        string key = reader.GetAttribute(Xml.DiscoveryFileMapSource);

                        reader.MoveToElement();
                        empty = reader.IsEmptyElement;
                        reader.ReadStartElement();

                        this.DiscoveryFileMap[key] = (empty) ? string.Empty : reader.ReadString();

                        if (!empty)
                        {
                            reader.ReadEndElement();
                        }

                        reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);
                    }
                }

                if (!empty)
                {
                    reader.ReadEndElement();
                }

                reader.ConsumeUntilFirst(XmlReaderHelper.ElementFilter);
            }

            this.ExecutionCommandLine = CommandLine.FromString(reader.ReadElementString(Xml.ExecutionCommandLine));

            reader.ReadEndElement();
        }