public void SingleRoot()
        {
            var proc = new XmlDocumentProcessor();
            var rootProc = new XmlElementsSequencer();
            proc.Register("root",rootProc);

            var doc = new XmlDocument();
            doc.LoadXml(@"<root/>");

            proc.Execute(doc);

            Assert.That( rootProc.ToString(), Is.EqualTo("open root;close root;") );
        }
        public void RootAndTwoChildren()
        {
            var proc = new XmlDocumentProcessor();
            var seq = new XmlElementsSequencer();
            proc.Register("root",seq);
            proc.Register("a",seq);

            var doc = new XmlDocument();
            doc.LoadXml(@"<root><a/><a/></root>");

            proc.Execute(doc);

            Assert.That( seq.ToString(), Is.EqualTo("open root;begin root>a;open a;close a;end a>root;begin root>a;open a;close a;end a>root;close root;") );
        }
        public void ComplexDocument()
        {
            var proc = new XmlDocumentProcessor();
            var seq = new XmlElementsSequencer();
            proc.Register("root",seq);
            proc.Register("a",seq);
            proc.Register("b",seq);
            proc.Register("c",seq);

            var doc = new XmlDocument();
            doc.LoadXml(@"<root><a id='1'><b>foo</b><c>bar</c></a><a id='2'/></root>");

            proc.Execute(doc);

            Assert.That( seq.ToString(), Is.EqualTo("open root;begin root>a;open a[1];begin a>b;open b;close b;end b>a;begin a>c;open c;close c;end c>a;close a[1];end a>root;begin root>a;open a[2];close a[2];end a>root;close root;") );
        }