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()); }
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()); }
public virtual void ShouldParseTextNodeWithSpecialCharactersNotCdata() { XmlNode node = CreateNode("<something><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.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()); }