diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs
new file mode 100644
index 0000000000..62e814f74c
--- /dev/null
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs
@@ -0,0 +1,31 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.Framework.Internal;
+
+namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
+{
+ ///
+ /// Provides a hint of the 's output element.
+ ///
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
+ public sealed class OutputElementHintAttribute : Attribute
+ {
+ ///
+ /// Instantiates a new instance of the class.
+ ///
+ ///
+ /// The HTML element the may output.
+ ///
+ public OutputElementHintAttribute([NotNull] string outputElement)
+ {
+ OutputElement = outputElement;
+ }
+
+ ///
+ /// The HTML element the may output.
+ ///
+ public string OutputElement { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs
index 97b54512b2..e6ce710d9e 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs
@@ -82,12 +82,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
IEnumerable targetElementAttributes,
bool designTime)
{
- TagHelperUsageDescriptor typeUsageDescriptor = null;
+ TagHelperDesignTimeDescriptor typeDesignTimeDescriptor = null;
#if !DNXCORE50
if (designTime)
{
- typeUsageDescriptor = TagHelperUsageDescriptorFactory.CreateDescriptor(typeInfo.GetType());
+ typeDesignTimeDescriptor = TagHelperDesignTimeDescriptorFactory.CreateDescriptor(typeInfo.GetType());
}
#endif
@@ -111,7 +111,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
assemblyName,
attributeDescriptors,
requiredAttributes: Enumerable.Empty(),
- usageDescriptor: typeUsageDescriptor)
+ designTimeDescriptor: typeDesignTimeDescriptor)
};
}
@@ -122,7 +122,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
assemblyName,
attributeDescriptors,
attribute,
- typeUsageDescriptor));
+ typeDesignTimeDescriptor));
}
private static TagHelperDescriptor BuildTagHelperDescriptor(
@@ -130,7 +130,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
string assemblyName,
IEnumerable attributeDescriptors,
TargetElementAttribute targetElementAttribute,
- TagHelperUsageDescriptor usageDescriptor)
+ TagHelperDesignTimeDescriptor designTimeDescriptor)
{
var requiredAttributes = GetCommaSeparatedValues(targetElementAttribute.Attributes);
@@ -140,7 +140,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
assemblyName,
attributeDescriptors,
requiredAttributes,
- usageDescriptor);
+ designTimeDescriptor);
}
private static TagHelperDescriptor BuildTagHelperDescriptor(
@@ -149,7 +149,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
string assemblyName,
IEnumerable attributeDescriptors,
IEnumerable requiredAttributes,
- TagHelperUsageDescriptor usageDescriptor)
+ TagHelperDesignTimeDescriptor designTimeDescriptor)
{
return new TagHelperDescriptor(
prefix: string.Empty,
@@ -158,7 +158,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
assemblyName: assemblyName,
attributes: attributeDescriptors,
requiredAttributes: requiredAttributes,
- usageDescriptor: usageDescriptor);
+ designTimeDescriptor: designTimeDescriptor);
}
///
@@ -462,12 +462,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
bool isIndexer,
bool designTime)
{
- TagHelperUsageDescriptor propertyUsageDescriptor = null;
+ TagHelperAttributeDesignTimeDescriptor propertyDesignTimeDescriptor = null;
#if !DNXCORE50
if (designTime)
{
- propertyUsageDescriptor = TagHelperUsageDescriptorFactory.CreateDescriptor(property);
+ propertyDesignTimeDescriptor =
+ TagHelperDesignTimeDescriptorFactory.CreateAttributeDescriptor(property);
}
#endif
@@ -476,7 +477,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
property.Name,
typeName,
isIndexer,
- propertyUsageDescriptor);
+ propertyDesignTimeDescriptor);
}
private static bool IsAccessibleProperty(PropertyInfo property)
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorResolver.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorResolver.cs
index fa1835b421..7d2e2835fd 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorResolver.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorResolver.cs
@@ -154,7 +154,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
descriptor.AssemblyName,
descriptor.Attributes,
descriptor.RequiredAttributes,
- descriptor.UsageDescriptor));
+ descriptor.DesignTimeDescriptor));
}
return descriptors;
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperUsageDescriptorFactory.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDesignTimeDescriptorFactory.cs
similarity index 64%
rename from src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperUsageDescriptorFactory.cs
rename to src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDesignTimeDescriptorFactory.cs
index ee7a191894..5e0a10979a 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperUsageDescriptorFactory.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDesignTimeDescriptorFactory.cs
@@ -14,40 +14,69 @@ using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
///
- /// Factory for providing s from s and
- /// s.
+ /// Factory for providing s from s and
+ /// s from s.
///
- public static class TagHelperUsageDescriptorFactory
+ public static class TagHelperDesignTimeDescriptorFactory
{
///
- /// Creates a from the given .
+ /// Creates a from the given .
///
- /// The to create a from.
- /// A that describes the summary and remarks XML documentation
+ ///
+ /// The to create a from.
+ ///
+ /// A that describes design time specific information
/// for the given .
- public static TagHelperUsageDescriptor CreateDescriptor([NotNull] Type type)
+ public static TagHelperDesignTimeDescriptor CreateDescriptor([NotNull] Type type)
{
var id = XmlDocumentationProvider.GetId(type);
+ var documentationDescriptor = CreateDocumentationDescriptor(type.Assembly, id);
- return CreateDescriptorCore(type.Assembly, id);
+ // Purposefully not using the TypeInfo.GetCustomAttributes method here to make it easier to mock the Type.
+ var outputElementHintAttribute = type
+ .GetCustomAttributes(inherit: false)
+ ?.OfType()
+ .FirstOrDefault();
+ var outputElementHint = outputElementHintAttribute?.OutputElement;
+
+ if (documentationDescriptor != null || outputElementHint != null)
+ {
+ return new TagHelperDesignTimeDescriptor(
+ documentationDescriptor?.Summary,
+ documentationDescriptor?.Remarks,
+ outputElementHint);
+ }
+
+ return null;
}
///
- /// Creates a from the given .
+ /// Creates a from the given
+ /// .
///
- /// The to create a
- /// from.
- /// A that describes the summary and remarks XML documentation
- /// for the given .
- public static TagHelperUsageDescriptor CreateDescriptor([NotNull] PropertyInfo propertyInfo)
+ ///
+ /// The to create a from.
+ ///
+ /// A that describes design time specific
+ /// information for the given .
+ public static TagHelperAttributeDesignTimeDescriptor CreateAttributeDescriptor(
+ [NotNull] PropertyInfo propertyInfo)
{
var id = XmlDocumentationProvider.GetId(propertyInfo);
var declaringAssembly = propertyInfo.DeclaringType.Assembly;
+ var documentationDescriptor = CreateDocumentationDescriptor(declaringAssembly, id);
- return CreateDescriptorCore(declaringAssembly, id);
+ if (documentationDescriptor != null)
+ {
+ return new TagHelperAttributeDesignTimeDescriptor(
+ documentationDescriptor.Summary,
+ documentationDescriptor.Remarks);
+ }
+
+ return null;
}
- private static TagHelperUsageDescriptor CreateDescriptorCore(Assembly assembly, string id)
+ private static DocumentationDescriptor CreateDocumentationDescriptor(Assembly assembly, string id)
{
var assemblyLocation = assembly.Location;
@@ -77,7 +106,11 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
if (!string.IsNullOrEmpty(summary) || !string.IsNullOrEmpty(remarks))
{
- return new TagHelperUsageDescriptor(summary, remarks);
+ return new DocumentationDescriptor
+ {
+ Summary = summary,
+ Remarks = remarks
+ };
}
}
@@ -157,6 +190,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
return xmlDocumentationFile;
}
+
+ private class DocumentationDescriptor
+ {
+ public string Summary { get; set; }
+ public string Remarks { get; set; }
+ }
}
}
#endif
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDescriptor.cs b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDescriptor.cs
index b994136e1d..593fc220b3 100644
--- a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDescriptor.cs
+++ b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDescriptor.cs
@@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
propertyInfo.PropertyType.FullName,
isIndexer: false,
isStringProperty: propertyInfo.PropertyType == typeof(string),
- usageDescriptor: null)
+ designTimeDescriptor: null)
{
}
@@ -40,8 +40,8 @@ namespace Microsoft.AspNet.Razor.TagHelpers
/// If true this is used for dictionary indexer assignments.
/// Otherwise this is used for property assignment.
///
- /// The that contains information about
- /// use of this attribute.
+ /// The that contains
+ /// design time information about this attribute.
///
/// HTML attribute names are matched case-insensitively, regardless of .
///
@@ -50,14 +50,14 @@ namespace Microsoft.AspNet.Razor.TagHelpers
[NotNull] string propertyName,
[NotNull] string typeName,
bool isIndexer,
- TagHelperUsageDescriptor usageDescriptor)
+ TagHelperAttributeDesignTimeDescriptor designTimeDescriptor)
: this(
name,
propertyName,
typeName,
isIndexer,
isStringProperty: string.Equals(typeName, typeof(string).FullName, StringComparison.Ordinal),
- usageDescriptor: usageDescriptor)
+ designTimeDescriptor: designTimeDescriptor)
{
}
@@ -68,14 +68,14 @@ namespace Microsoft.AspNet.Razor.TagHelpers
[NotNull] string typeName,
bool isIndexer,
bool isStringProperty,
- TagHelperUsageDescriptor usageDescriptor)
+ TagHelperAttributeDesignTimeDescriptor designTimeDescriptor)
{
Name = name;
PropertyName = propertyName;
TypeName = typeName;
IsIndexer = isIndexer;
IsStringProperty = isStringProperty;
- UsageDescriptor = usageDescriptor;
+ DesignTimeDescriptor = designTimeDescriptor;
}
///
@@ -119,9 +119,10 @@ namespace Microsoft.AspNet.Razor.TagHelpers
public string TypeName { get; }
///
- /// The that contains information about use of this attribute.
+ /// The that contains design time information about
+ /// this attribute.
///
- public TagHelperUsageDescriptor UsageDescriptor { get; }
+ public TagHelperAttributeDesignTimeDescriptor DesignTimeDescriptor { get; }
///
/// Determines whether HTML attribute matches this
diff --git a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperUsageDescriptor.cs b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDesignTimeDescriptor.cs
similarity index 79%
rename from src/Microsoft.AspNet.Razor/TagHelpers/TagHelperUsageDescriptor.cs
rename to src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDesignTimeDescriptor.cs
index 5a3918f4e9..fe98fec8a5 100644
--- a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperUsageDescriptor.cs
+++ b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeDesignTimeDescriptor.cs
@@ -6,14 +6,14 @@ namespace Microsoft.AspNet.Razor.TagHelpers
///
/// A metadata class containing information about tag helper use.
///
- public class TagHelperUsageDescriptor
+ public class TagHelperAttributeDesignTimeDescriptor
{
///
- /// Instantiates a new instance of .
+ /// Instantiates a new instance of .
///
/// A summary on how to use a tag helper.
/// Remarks on how to use a tag helper.
- public TagHelperUsageDescriptor(string summary, string remarks)
+ public TagHelperAttributeDesignTimeDescriptor(string summary, string remarks)
{
Summary = summary;
Remarks = remarks;
diff --git a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptor.cs b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptor.cs
index cc0e4c6808..bea47ddab7 100644
--- a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptor.cs
+++ b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptor.cs
@@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
assemblyName: assemblyName,
attributes: attributes,
requiredAttributes: requiredAttributes,
- usageDescriptor: null)
+ designTimeDescriptor: null)
{
}
@@ -82,8 +82,8 @@ namespace Microsoft.AspNet.Razor.TagHelpers
///
/// The attribute names required for the tag helper to target the HTML tag.
///
- /// The that contains information about
- /// how to use the tag helper at design time.
+ /// The that contains design
+ /// time information about the tag helper.
public TagHelperDescriptor(
string prefix,
[NotNull] string tagName,
@@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
[NotNull] string assemblyName,
[NotNull] IEnumerable attributes,
[NotNull] IEnumerable requiredAttributes,
- TagHelperUsageDescriptor usageDescriptor)
+ TagHelperDesignTimeDescriptor designTimeDescriptor)
{
Prefix = prefix ?? string.Empty;
TagName = tagName;
@@ -100,7 +100,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
AssemblyName = assemblyName;
Attributes = new List(attributes);
RequiredAttributes = new List(requiredAttributes);
- UsageDescriptor = usageDescriptor;
+ DesignTimeDescriptor = designTimeDescriptor;
}
///
@@ -144,9 +144,9 @@ namespace Microsoft.AspNet.Razor.TagHelpers
public IReadOnlyList RequiredAttributes { get; }
///
- /// The that contains information about how to use the tag helper at
- /// design time.
+ /// The that contains design time information about this
+ /// tag helper.
///
- public TagHelperUsageDescriptor UsageDescriptor { get; }
+ public TagHelperDesignTimeDescriptor DesignTimeDescriptor { get; }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptorComparer.cs b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptorComparer.cs
index 2ea1b9dbee..3cee0606b9 100644
--- a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptorComparer.cs
+++ b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDescriptorComparer.cs
@@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
/// Determines equality based on ,
/// , ,
/// and . Ignores
- /// because it can be inferred directly from
+ /// because it can be inferred directly from
/// and .
///
public virtual bool Equals(TagHelperDescriptor descriptorX, TagHelperDescriptor descriptorY)
diff --git a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDesignTimeDescriptor.cs b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDesignTimeDescriptor.cs
new file mode 100644
index 0000000000..177f9b1100
--- /dev/null
+++ b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperDesignTimeDescriptor.cs
@@ -0,0 +1,42 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.AspNet.Razor.TagHelpers
+{
+ ///
+ /// A metadata class containing design time information about a tag helper.
+ ///
+ public class TagHelperDesignTimeDescriptor
+ {
+ ///
+ /// Instantiates a new instance of .
+ ///
+ /// A summary on how to use a tag helper.
+ /// Remarks on how to use a tag helper.
+ /// The HTML element a tag helper may output.
+ public TagHelperDesignTimeDescriptor(string summary, string remarks, string outputElementHint)
+ {
+ Summary = summary;
+ Remarks = remarks;
+ OutputElementHint = outputElementHint;
+ }
+
+ ///
+ /// A summary of how to use a tag helper.
+ ///
+ public string Summary { get; }
+
+ ///
+ /// Remarks about how to use a tag helper.
+ ///
+ public string Remarks { get; }
+
+ ///
+ /// The HTML element a tag helper may output.
+ ///
+ ///
+ /// In IDEs supporting IntelliSense, may override the HTML information provided at design time.
+ ///
+ public string OutputElementHint { get; }
+ }
+}
\ No newline at end of file
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CaseSensitiveTagHelperDescriptorComparer.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CaseSensitiveTagHelperDescriptorComparer.cs
index 280d6dfb51..5b3b8b43d4 100644
--- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CaseSensitiveTagHelperDescriptorComparer.cs
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CaseSensitiveTagHelperDescriptorComparer.cs
@@ -36,7 +36,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
StringComparer.Ordinal) &&
descriptorX.Attributes.SequenceEqual(
descriptorY.Attributes,
- TagHelperAttributeDescriptorComparer.Default);
+ TagHelperAttributeDescriptorComparer.Default) &&
+ TagHelperDesignTimeDescriptorComparer.Default.Equals(
+ descriptorX.DesignTimeDescriptor,
+ descriptorY.DesignTimeDescriptor);
}
public override int GetHashCode(TagHelperDescriptor descriptor)
@@ -44,7 +47,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
var hashCodeCombiner = HashCodeCombiner.Start()
.Add(base.GetHashCode(descriptor))
.Add(descriptor.TagName, StringComparer.Ordinal)
- .Add(descriptor.Prefix);
+ .Add(descriptor.Prefix, StringComparer.Ordinal);
+
+ if (descriptor.DesignTimeDescriptor != null)
+ {
+ hashCodeCombiner.Add(
+ TagHelperDesignTimeDescriptorComparer.Default.GetHashCode(descriptor.DesignTimeDescriptor));
+ }
foreach (var requiredAttribute in descriptor.RequiredAttributes)
{
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CommonTagHelpers.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CommonTagHelpers.cs
index 67d2433f49..90f7cd5857 100644
--- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CommonTagHelpers.cs
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/CommonTagHelpers.cs
@@ -41,6 +41,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// Inherits from .
///
+ [OutputElementHint("p")]
public class DocumentedTagHelper : TagHelper
{
///
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDescriptorComparer.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDescriptorComparer.cs
index d08024bb70..f0d6a93d15 100644
--- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDescriptorComparer.cs
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDescriptorComparer.cs
@@ -30,9 +30,9 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
string.Equals(descriptorX.Name, descriptorY.Name, StringComparison.Ordinal) &&
string.Equals(descriptorX.PropertyName, descriptorY.PropertyName, StringComparison.Ordinal) &&
string.Equals(descriptorX.TypeName, descriptorY.TypeName, StringComparison.Ordinal) &&
- TagHelperUsageDescriptorComparer.Default.Equals(
- descriptorX.UsageDescriptor,
- descriptorY.UsageDescriptor);
+ TagHelperAttributeDesignTimeDescriptorComparer.Default.Equals(
+ descriptorX.DesignTimeDescriptor,
+ descriptorY.DesignTimeDescriptor);
}
public int GetHashCode(TagHelperAttributeDescriptor descriptor)
@@ -44,7 +44,8 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
.Add(descriptor.Name, StringComparer.Ordinal)
.Add(descriptor.PropertyName, StringComparer.Ordinal)
.Add(descriptor.TypeName, StringComparer.Ordinal)
- .Add(TagHelperUsageDescriptorComparer.Default.GetHashCode(descriptor.UsageDescriptor))
+ .Add(TagHelperAttributeDesignTimeDescriptorComparer.Default.GetHashCode(
+ descriptor.DesignTimeDescriptor))
.CombinedHash;
}
}
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDesignTimeDescriptorComparer.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDesignTimeDescriptorComparer.cs
new file mode 100644
index 0000000000..345c6c4eef
--- /dev/null
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeDesignTimeDescriptorComparer.cs
@@ -0,0 +1,45 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using Microsoft.AspNet.Razor.TagHelpers;
+using Microsoft.Internal.Web.Utils;
+
+namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
+{
+ public class TagHelperAttributeDesignTimeDescriptorComparer :
+ IEqualityComparer
+ {
+ public static readonly TagHelperAttributeDesignTimeDescriptorComparer Default =
+ new TagHelperAttributeDesignTimeDescriptorComparer();
+
+ private TagHelperAttributeDesignTimeDescriptorComparer()
+ {
+ }
+
+ public bool Equals(
+ TagHelperAttributeDesignTimeDescriptor descriptorX,
+ TagHelperAttributeDesignTimeDescriptor descriptorY)
+ {
+ if (descriptorX == descriptorY)
+ {
+ return true;
+ }
+
+ return descriptorX != null &&
+ descriptorY != null &&
+ string.Equals(descriptorX.Summary, descriptorY.Summary, StringComparison.Ordinal) &&
+ string.Equals(descriptorX.Remarks, descriptorY.Remarks, StringComparison.Ordinal);
+ }
+
+ public int GetHashCode(TagHelperAttributeDesignTimeDescriptor descriptor)
+ {
+ return HashCodeCombiner
+ .Start()
+ .Add(descriptor.Summary, StringComparer.Ordinal)
+ .Add(descriptor.Remarks, StringComparer.Ordinal)
+ .CombinedHash;
+ }
+ }
+}
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs
index 85f8b3cd35..9d66a23d0d 100644
--- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs
@@ -412,7 +412,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeof(int).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null)
+ designTimeDescriptor: null)
});
// Act
@@ -533,7 +533,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeof(object).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null)
+ designTimeDescriptor: null)
});
// Act
@@ -588,7 +588,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeof(string).FullName,
isIndexer: false,
isStringProperty: true,
- usageDescriptor: null)
+ designTimeDescriptor: null)
}),
new TagHelperDescriptor(
"p",
@@ -602,7 +602,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeof(string).FullName,
isIndexer: false,
isStringProperty: true,
- usageDescriptor: null)
+ designTimeDescriptor: null)
})
};
@@ -935,14 +935,14 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeName: typeof(IDictionary).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null),
+ designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "dictionary-property-",
propertyName: nameof(DefaultValidHtmlAttributePrefix.DictionaryProperty),
typeName: typeof(string).FullName,
isIndexer: true,
isStringProperty: true,
- usageDescriptor: null),
+ designTimeDescriptor: null),
},
new string[0]
},
@@ -956,14 +956,14 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeName: typeof(IDictionary).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null),
+ designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "valid-prefix",
propertyName: nameof(SingleValidHtmlAttributePrefix.DictionaryProperty),
typeName: typeof(string).FullName,
isIndexer: true,
isStringProperty: true,
- usageDescriptor: null),
+ designTimeDescriptor: null),
},
new string[0]
},
@@ -977,77 +977,77 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
typeName: typeof(Dictionary).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null),
+ designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "valid-name2",
propertyName: nameof(MultipleValidHtmlAttributePrefix.DictionarySubclassProperty),
typeName: typeof(DictionarySubclass).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null),
+ designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "valid-name3",
propertyName: nameof(MultipleValidHtmlAttributePrefix.DictionaryWithoutParameterlessConstructorProperty),
typeName: typeof(DictionaryWithoutParameterlessConstructor).FullName,
isIndexer: false,
isStringProperty: false,
- usageDescriptor: null),
+ designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "valid-name4",
propertyName: nameof(MultipleValidHtmlAttributePrefix.GenericDictionarySubclassProperty),
typeName: typeof(GenericDictionarySubclass