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"); }
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"); }
public virtual void ShouldParseTextNodeWithSpecialCharactersNotCdata() { XmlNode node = CreateNode("<something><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.IsFalse(((ST)parseResult).IsCdata, "not cdata"); Assert.AreEqual("<cats think they're > humans & dogs 99% of the time/>", parseResult.BareValue, "proper text returned"); }