Beispiel #1
0
        public void NamespaceURIRestoredAfterFake()
        {
            XmlReader reader = new XmlFragmentReader("foo", "mvp-xml", XmlReader.Create(new StringReader("<item/>")));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(String.Empty, reader.NamespaceURI);
        }
Beispiel #2
0
        public void CannotReadPastFake()
        {
            XmlReader reader = new XmlFragmentReader("foo", "mvp-xml", XmlReader.Create(new StringReader("<item/>")));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("mvp-xml", reader.NamespaceURI);
            Assert.IsFalse(reader.Read());
        }
Beispiel #3
0
        public void RootNameMatchesFake()
        {
            XmlReader reader = new XmlFragmentReader("foo", XmlReader.Create(new StringReader("<item/>")));

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("foo", reader.LocalName);
        }
Beispiel #4
0
        public void CanFakeRoot()
        {
            XmlQualifiedName qname  = new XmlQualifiedName("foo", "mvp-xml");
            XmlReader        reader = new XmlFragmentReader(qname, XmlReader.Create(new StringReader("<item id='1'>foo</item>")));

            Assert.AreEqual(ReadState.Initial, reader.ReadState);
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(qname.Name, reader.LocalName);
            Assert.AreEqual(qname.Namespace, reader.NamespaceURI);
            Assert.IsFalse(reader.HasAttributes);
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("item", reader.LocalName);
            reader.Skip();
            Assert.AreEqual(qname.Name, reader.LocalName);
            Assert.AreEqual(qname.Namespace, reader.NamespaceURI);
            Assert.IsFalse(reader.Read());
            Assert.AreEqual(ReadState.EndOfFile, reader.ReadState);
        }