Align `TagHelperOutputExtensionsTest.CaseSensitiveTagHelperAttributeComparer` with Razor.Runtime version

- was missing `Minimized` comparison
This commit is contained in:
Doug Bunting 2015-07-29 15:42:41 -07:00
parent 7120b2ff92
commit 260ac2939e
1 changed files with 10 additions and 7 deletions

View File

@ -607,15 +607,18 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{
}
public bool Equals(
IReadOnlyTagHelperAttribute attributeX,
IReadOnlyTagHelperAttribute attributeY)
public bool Equals(IReadOnlyTagHelperAttribute attributeX, IReadOnlyTagHelperAttribute attributeY)
{
return
attributeX == attributeY ||
// Normal comparer doesn't care about the Name case, in tests we do.
if (attributeX == attributeY)
{
return true;
}
// Normal comparer (TagHelperAttribute.Equals()) doesn't care about the Name case, in tests we do.
return attributeX != null &&
string.Equals(attributeX.Name, attributeY.Name, StringComparison.Ordinal) &&
Equals(attributeX.Value, attributeY.Value);
attributeX.Minimized == attributeY.Minimized &&
(attributeX.Minimized || Equals(attributeX.Value, attributeY.Value));
}
public int GetHashCode(IReadOnlyTagHelperAttribute attribute)