public void DotNetCommentPermission_FromXml_Indexer() { //arrange XElement element = XElement.Parse("<permission cref='P:A.B.Item(System.Int32)'>Comments</permission>", LoadOptions.PreserveWhitespace); //act DotNetCommentQualifiedLinkedGroup result = DotNetCommentQualifiedLinkedGroup.FromVisualStudioXml(element); //assert Assert.IsTrue(result is DotNetCommentMethodLinkedGroup); }
internal static IMarkdownInLine ToMDLink(DotNetCommentQualifiedLinkedGroup commentGroup, DotNetMember parent = null) { string text = String.Join("", DotNetCommentGroupToMarkdownLine(commentGroup, parent).Elements.Select(x => x.ToMarkdownString(null)).ToArray()); IMarkdownInLine plainLink = ToMDLink(commentGroup.QualifiedLink, parent); if (plainLink is MarkdownInlineLink) { return(new MarkdownInlineLink(text, (plainLink as MarkdownInlineLink).Url)); } return(new MarkdownText(text)); }
public void DotNetCommentQualifiedLinkedGroup_FromXml_TypeLink_Empty() { //arrange string fullNamespace = "System.X"; string typeName = "ArgumentException"; string qualifiedName = fullNamespace + "." + typeName; XElement element = XElement.Parse("<exception cref='" + qualifiedName + "' />", LoadOptions.PreserveWhitespace); //act DotNetCommentQualifiedLinkedGroup result = DotNetCommentQualifiedLinkedGroup.FromVisualStudioXml(element); //assert Assert.AreEqual(qualifiedName, result.Link.FullName); Assert.AreEqual(0, result.Comments.Count); }
public void DotNetCommentQualifiedLinkedGroup_FromXml_TypeLink_Full() { //arrange string fullNamespace = "System.X"; string typeName = "ArgumentException"; string qualifiedName = fullNamespace + "." + typeName; string comments = Utilities.LoadText(Utilities.GetPathTo("data/DotNetCommentGroup_XmlCommentsNestedInTag.txt")); XElement element = XElement.Parse("<exception cref='" + qualifiedName + "'>" + comments + "</exception>", LoadOptions.PreserveWhitespace); //act DotNetCommentQualifiedLinkedGroup result = DotNetCommentQualifiedLinkedGroup.FromVisualStudioXml(element); //assert Assert.AreEqual(qualifiedName, result.Link.FullName); Assert.AreEqual(14, result.Comments.Count); }
public void DotNetCommentQualifiedLinkedGroup_FromXml_MethodLink_Empty() { //arrange string fullNamespace = "System.X"; string typeName = "MyType"; string methodName = "MyMethod"; string parameters = "(int, string)"; string qualifiedName = fullNamespace + "." + typeName + "." + methodName; XElement element = XElement.Parse("<permission cref='" + qualifiedName + parameters + "' />", LoadOptions.PreserveWhitespace); //act DotNetCommentQualifiedLinkedGroup result = DotNetCommentQualifiedLinkedGroup.FromVisualStudioXml(element); //assert Assert.AreEqual(qualifiedName, result.Link.FullName); Assert.AreEqual(0, result.Comments.Count); }
public void DotNetCommentPermission_FromXml_FullyQualifiedLink() { //arrange string _namespace = "A"; string typeName = "B"; string fieldName = "C"; string fullName = _namespace + "." + typeName + "." + fieldName; XElement element = XElement.Parse("<permission cref='F:" + fullName + "'>Comments</permission>", LoadOptions.PreserveWhitespace); //act DotNetCommentQualifiedLinkedGroup result = DotNetCommentQualifiedLinkedGroup.FromVisualStudioXml(element); //assert Assert.AreEqual(fullName, result.QualifiedLink.Name.FullName); Assert.AreEqual(fieldName, result.QualifiedLink.Name.LocalName); Assert.AreEqual(_namespace + "." + typeName, result.QualifiedLink.Name.FullNamespace); }
public void DotNetIndexer_Assembly_MatchesPermission() { //arrange Type type = typeof(A); DotNetType dotNetType = DotNetType.FromVisualStudioXml(XElement.Parse("<member name='T:DataFilesTest.DotNetIndexerTests.A'></member>", LoadOptions.PreserveWhitespace)); dotNetType.AddMember(DotNetProperty.FromVisualStudioXml(XElement.Parse("<member name='P:DataFilesTest.DotNetIndexerTests.A.Item(System.String)'></member>", LoadOptions.PreserveWhitespace))); dotNetType.AddAssemblyInfo(type, dotNetType.Name); XElement permissionElement = XElement.Parse("<permission cref='P:DataFilesTest.DotNetIndexerTests.A.Item(System.String)'></permission>", LoadOptions.PreserveWhitespace); DotNetCommentQualifiedLinkedGroup permissionComment = DotNetCommentQualifiedLinkedGroup.FromVisualStudioXml(permissionElement); //act DotNetIndexer indexerResult = dotNetType.Properties.OfType <DotNetIndexer>().Cast <DotNetIndexer>().First(); bool matchesResult = indexerResult.Matches(permissionComment); //assert Assert.IsTrue(matchesResult); }