public void DotNetCommentCode_FromXml_CDATA() { //arrange string xml = "<html><body></body></html>"; XElement element = XElement.Parse("<para>Word word word <![CDATA[" + xml + "]]> word word word.</para>", LoadOptions.PreserveWhitespace); //act DotNetCommentGroup result = DotNetCommentGroup.FromVisualStudioXml(element); //assert Assert.AreEqual(3, result.Comments.Count); Assert.AreEqual(xml, result.Comments[1].ToString()); }
public void DotNetCommentText_FromXml_SpaceAfterParamRef() { //arrange XElement element = XElement.Parse(@"<summary> Split <paramref name='text'/> on the <paramref name='delimiter'/> but do not split if <paramref name='delimiter'/> is nested within matched braces. Supports braces: {}, [], (), and <![CDATA[<>]]>. </summary>", LoadOptions.PreserveWhitespace); //act DotNetCommentGroup result = DotNetCommentGroup.FromVisualStudioXml(element); //assert Assert.AreEqual("Split ", (result[0] as DotNetCommentText).Text); Assert.AreEqual(" on the ", (result[2] as DotNetCommentText).Text); Assert.AreEqual(" \nbut do not split if ", (result[4] as DotNetCommentText).Text); Assert.AreEqual(" is nested within matched braces.\nSupports braces: {}, [], (), and ", (result[6] as DotNetCommentText).Text); }
public void DotNetCommentTypeParameterLink_FromXml_AfterText() { //arrange string xml = "<summary>The type-parameter names are: <typeparamref name='A'/>, <typeparamref name='B'/>, and <typeparamref name='C'/>.</summary>"; XElement element = XElement.Parse(xml, LoadOptions.PreserveWhitespace); //act DotNetCommentGroup result = DotNetCommentGroup.FromVisualStudioXml(element); //assert Assert.AreEqual(7, result.Comments.Count); Assert.AreEqual("The type-parameter names are: ", (result[0] as DotNetCommentText).Text); Assert.AreEqual("A", (result[1] as DotNetCommentTypeParameterLink).Name); Assert.AreEqual(", ", (result[2] as DotNetCommentText).Text); Assert.AreEqual("B", (result[3] as DotNetCommentTypeParameterLink).Name); Assert.AreEqual(", and ", (result[4] as DotNetCommentText).Text); Assert.AreEqual("C", (result[5] as DotNetCommentTypeParameterLink).Name); Assert.AreEqual(".", (result[6] as DotNetCommentText).Text); }