public void HtmlText_HasHtmlTags_TagsPreserved() { var content = "This has a <p> inside"; var escapedContent = new XElement("test", content).FirstNode.ToString(); var msg = new Message(XElement.Parse(@"<message guid='123' author='john' status='open' date='2009-07-18T23:53:04Z'>" +escapedContent+"</message>")); Assert.AreEqual(content, msg.GetSimpleHtmlText()); }
public void HtmlText_HasHtmlTagsAndData_GetJustHtml() { var content = "This has a <p> inside"; // this would work, too: HttpUtility.HtmlEncode(content); var escapedContent = new XElement("test", content).FirstNode.ToString(); var msg = new Message(XElement.Parse(@"<message guid='123' author='john' status='open' date='2009-07-18T23:53:04Z'>" + escapedContent + "<data>blah</data></message>")); Assert.AreEqual(content, msg.GetSimpleHtmlText()); }
public void HtmlText_HasOnlyData_GetEmptyString() { var msg = new Message(XElement.Parse(@"<message guid='123' author='john' status='open' date='2009-07-18T23:53:04Z'>" + "<data>blah</data></message>")); Assert.AreEqual(string.Empty, msg.GetSimpleHtmlText()); }