Ejemplo n.º 1
0
        public virtual void ShouldParseTextNodeWithEmptyCdata()
        {
            XmlNode node        = CreateNode("<something mediaType=\"text/plain\" representation=\"TXT\"><![CDATA[]]></something>");
            BareANY parseResult = new StR2ElementParser().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");
            Assert.IsTrue(this.xmlResult.IsValid());
        }
Ejemplo n.º 2
0
        public virtual void ShouldParseTextNodeAsCdata()
        {
            XmlNode node = CreateNode("<something mediaType=\"text/plain\" representation=\"TXT\"><![CDATA[<cats think they're > humans & dogs 99% of the time/>]]></something>"
                                      );
            BareANY parseResult = new StR2ElementParser().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");
            Assert.IsTrue(this.xmlResult.IsValid());
        }
Ejemplo 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 StR2ElementParser().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");
            Assert.IsTrue(this.xmlResult.IsValid());
        }