Esempio n. 1
0
        public virtual void ShouldParseTextNodeAsCdata()
        {
            XmlNode node        = CreateNode("<something><![CDATA[<cats think they're > humans & dogs 99% of the time/>]]></something>");
            BareANY parseResult = new StElementParser().Parse(CreateStContext("ST", 100), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsTrue(parseResult is ST);
            Assert.IsTrue(((ST)parseResult).IsCdata, "noted as cdata");
            Assert.AreEqual("<cats think they're > humans & dogs 99% of the time/>", parseResult.BareValue, "proper text returned");
        }
Esempio n. 2
0
        public virtual void ShouldParseTextNodeWithEmptyCdata()
        {
            XmlNode node        = CreateNode("<something><![CDATA[]]></something>");
            BareANY parseResult = new StElementParser().Parse(CreateStContext("ST"), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsTrue(parseResult is ST);
            Assert.IsTrue(((ST)parseResult).IsCdata, "noted as cdata");
            Assert.AreEqual(string.Empty, parseResult.BareValue, "proper text returned");
        }
Esempio n. 3
0
        public virtual void ShouldParseTextNodeWithSpecialCharactersNotCdata()
        {
            XmlNode node = CreateNode("<something>&lt;cats think they&apos;re &gt; humans &amp; dogs 99% of the time/&gt;</something>"
                                      );
            BareANY parseResult = new StElementParser().Parse(CreateStContext("ST", 100), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsTrue(parseResult is ST);
            Assert.IsFalse(((ST)parseResult).IsCdata, "not cdata");
            Assert.AreEqual("<cats think they're > humans & dogs 99% of the time/>", parseResult.BareValue, "proper text returned");
        }