public void TryCreateDescription_Element_MultipleAssociatedTagHelpers_ReturnsTrue() { // Arrange var descriptionFactory = new DefaultTagHelperDescriptionFactory(); var associatedTagHelperInfos = new[] { new TagHelperDescriptionInfo("Microsoft.AspNetCore.SomeTagHelper", "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>"), new TagHelperDescriptionInfo("Microsoft.AspNetCore.OtherTagHelper", "<summary>Also uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>"), }; var elementDescription = new ElementDescriptionInfo(associatedTagHelperInfos); // Act var result = descriptionFactory.TryCreateDescription(elementDescription, out var markdown); // Assert Assert.True(result); Assert.Equal(@"**SomeTagHelper** Uses `List<System.String>`s --- **OtherTagHelper** Also uses `List<System.String>`s ", markdown); }
public void TryCreateDescription_Attribute_MultipleAssociatedAttributes_ReturnsTrue() { // Arrange var descriptionFactory = new DefaultTagHelperDescriptionFactory(); var associatedAttributeDescriptions = new[] { new TagHelperAttributeDescriptionInfo( displayName: "string Microsoft.AspNetCore.SomeTagHelpers.SomeTypeName.SomeProperty", propertyName: "SomeProperty", returnTypeName: "System.String", documentation: "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>"), new TagHelperAttributeDescriptionInfo( displayName: "System.Boolean? Microsoft.AspNetCore.SomeTagHelpers.AnotherTypeName.AnotherProperty", propertyName: "AnotherProperty", returnTypeName: "System.Boolean?", documentation: "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>"), }; var attributeDescription = new AttributeDescriptionInfo(associatedAttributeDescriptions); // Act var result = descriptionFactory.TryCreateDescription(attributeDescription, out var markdown); // Assert Assert.True(result); Assert.Equal(@"**string** SomeTypeName.**SomeProperty** Uses `List<System.String>`s --- **Boolean?** AnotherTypeName.**AnotherProperty** Uses `List<System.String>`s ", markdown); }
public void TryCreateDescription_Attribute_PlainText_NoBold() { // Arrange var languageServer = LanguageServer; languageServer.ClientSettings.Capabilities.TextDocument.Completion.Value.CompletionItem.DocumentationFormat = new Container <MarkupKind>(MarkupKind.PlainText); var descriptionFactory = new DefaultTagHelperDescriptionFactory(languageServer); var associatedAttributeDescriptions = new[] { new TagHelperAttributeDescriptionInfo( displayName: "string Microsoft.AspNetCore.SomeTagHelpers.SomeTypeName.SomeProperty", propertyName: "SomeProperty", returnTypeName: "System.String", documentation: "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>") }; var attributeDescription = new AttributeDescriptionInfo(associatedAttributeDescriptions); // Act var result = descriptionFactory.TryCreateDescription(attributeDescription, out var markdown); // Assert Assert.True(result); Assert.Equal(@"string SomeTypeName.SomeProperty Uses `List<System.String>`s", markdown.Value); Assert.Equal(MarkupKind.PlainText, markdown.Kind); }
public void TryCreateDescription_NoAssociatedTagHelperDescriptions_ReturnsFalse() { // Arrange var descriptionFactory = new DefaultTagHelperDescriptionFactory(); var elementDescription = ElementDescriptionInfo.Default; // Act var result = descriptionFactory.TryCreateDescription(elementDescription, out var markdown); // Assert Assert.False(result); Assert.Null(markdown); }
public void TryCreateDescription_Element_SingleAssociatedTagHelper_ReturnsTrue() { // Arrange var descriptionFactory = new DefaultTagHelperDescriptionFactory(LanguageServer); var associatedTagHelperInfos = new[] { new TagHelperDescriptionInfo("Microsoft.AspNetCore.SomeTagHelper", "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>"), }; var elementDescription = new ElementDescriptionInfo(associatedTagHelperInfos); // Act var result = descriptionFactory.TryCreateDescription(elementDescription, out var markdown); // Assert Assert.True(result); Assert.Equal(@"**SomeTagHelper** Uses `List<System.String>`s", markdown.Value); Assert.Equal(MarkupKind.Markdown, markdown.Kind); }
public void TryCreateDescription_Element_BothPlainTextAndMarkdown_IsBold() { // Arrange var languageServer = LanguageServer; languageServer.ClientSettings.Capabilities.TextDocument.Completion.Value.CompletionItem.DocumentationFormat = new Container <MarkupKind>(MarkupKind.PlainText, MarkupKind.Markdown); var descriptionFactory = new DefaultTagHelperDescriptionFactory(languageServer); var associatedTagHelperInfos = new[] { new TagHelperDescriptionInfo("Microsoft.AspNetCore.SomeTagHelper", "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>"), }; var elementDescription = new ElementDescriptionInfo(associatedTagHelperInfos); // Act var result = descriptionFactory.TryCreateDescription(elementDescription, out var markdown); // Assert Assert.True(result); Assert.Equal(@"**SomeTagHelper** Uses `List<System.String>`s", markdown.Value); Assert.Equal(MarkupKind.Markdown, markdown.Kind); }
public void TryCreateDescription_Attribute_SingleAssociatedAttribute_ReturnsTrue() { // Arrange var descriptionFactory = new DefaultTagHelperDescriptionFactory(LanguageServer); var associatedAttributeDescriptions = new[] { new TagHelperAttributeDescriptionInfo( displayName: "string Microsoft.AspNetCore.SomeTagHelpers.SomeTypeName.SomeProperty", propertyName: "SomeProperty", returnTypeName: "System.String", documentation: "<summary>Uses <see cref=\"T:System.Collections.List{System.String}\" />s</summary>") }; var attributeDescription = new AttributeDescriptionInfo(associatedAttributeDescriptions); // Act var result = descriptionFactory.TryCreateDescription(attributeDescription, out var markdown); // Assert Assert.True(result); Assert.Equal(@"**string** SomeTypeName.**SomeProperty** Uses `List<System.String>`s", markdown.Value); Assert.Equal(MarkupKind.Markdown, markdown.Kind); }