Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
React to aspnet/Razor#196 to maintain VisualStudio compat test.
Browse files Browse the repository at this point in the history
- Add new `IsEnum` `TagHelperDescriptor` property to VS compatibility test.
  • Loading branch information
NTaylorMullen committed Oct 28, 2015
1 parent 3a3e63c commit 76bf9eb
Showing 1 changed file with 49 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public void TagHelperDescrictorsAreCompatibleWithPinnedVisualStudioVersion()
Remarks = "Some attribute level remarks.",
Summary = "Some attribute level summary."
}
},
new TagHelperAttributeDescriptor
{
IsIndexer = false,
IsEnum = true,
IsStringProperty = false,
Name = "bind-enum",
PropertyName = "BindEnum",
TypeName = "MyEnumNamespace",
DesignTimeDescriptor = new TagHelperAttributeDesignTimeDescriptor
{
Remarks = "Some enum attribute level remarks.",
Summary = "Some enum attribute level summary."
}
}
}
};
Expand Down Expand Up @@ -80,6 +94,20 @@ public void TagHelperDescrictorsAreCompatibleWithPinnedVisualStudioVersion()
Remarks = "Some attribute level remarks.",
Summary = "Some attribute level summary."
}
},
new VisualStudioTagHelperAttributeDescriptor
{
IsIndexer = false,
IsEnum = true,
IsStringProperty = false,
Name = "bind-enum",
PropertyName = "BindEnum",
TypeName = "MyEnumNamespace",
DesignTimeDescriptor = new VisualStudioTagHelperAttributeDesignTimeDescriptor
{
Remarks = "Some enum attribute level remarks.",
Summary = "Some enum attribute level summary."
}
}
}
};
Expand All @@ -105,22 +133,30 @@ public void TagHelperDescrictorsAreCompatibleWithPinnedVisualStudioVersion()
Assert.Equal(expectedDTDescriptor.Remarks, dtDescriptor.Remarks, StringComparer.Ordinal);
Assert.Equal(expectedDTDescriptor.Summary, dtDescriptor.Summary, StringComparer.Ordinal);

var attribute = Assert.Single(vsDescriptor.Attributes);
var expectedAttribute = Assert.Single(expectedVSDescriptor.Attributes);
Assert.Equal(attribute.IsIndexer, expectedAttribute.IsIndexer);
Assert.Equal(attribute.IsStringProperty, expectedAttribute.IsStringProperty);
Assert.Equal(attribute.Name, expectedAttribute.Name, StringComparer.Ordinal);
Assert.Equal(attribute.PropertyName, expectedAttribute.PropertyName, StringComparer.Ordinal);
Assert.Equal(attribute.TypeName, expectedAttribute.TypeName, StringComparer.Ordinal);
var attributes = vsDescriptor.Attributes.ToArray();
var expectedAttributes = expectedVSDescriptor.Attributes.ToArray();
Assert.Equal(attributes.Length, expectedAttributes.Length);

var dtAttribute = attribute.DesignTimeDescriptor;
var expectedDTAttribute = expectedAttribute.DesignTimeDescriptor;
Assert.Equal(dtAttribute.Remarks, expectedDTAttribute.Remarks, StringComparer.Ordinal);
Assert.Equal(dtAttribute.Summary, expectedDTAttribute.Summary, StringComparer.Ordinal);
for (var i = 0; i < attributes.Length; i++)
{
var attribute = attributes[i];
var expectedAttribute = expectedAttributes[i];
Assert.Equal(attribute.IsIndexer, expectedAttribute.IsIndexer);
Assert.Equal(attribute.IsEnum, expectedAttribute.IsEnum);
Assert.Equal(attribute.IsStringProperty, expectedAttribute.IsStringProperty);
Assert.Equal(attribute.Name, expectedAttribute.Name, StringComparer.Ordinal);
Assert.Equal(attribute.PropertyName, expectedAttribute.PropertyName, StringComparer.Ordinal);
Assert.Equal(attribute.TypeName, expectedAttribute.TypeName, StringComparer.Ordinal);

var dtAttribute = attribute.DesignTimeDescriptor;
var expectedDTAttribute = expectedAttribute.DesignTimeDescriptor;
Assert.Equal(dtAttribute.Remarks, expectedDTAttribute.Remarks, StringComparer.Ordinal);
Assert.Equal(dtAttribute.Summary, expectedDTAttribute.Summary, StringComparer.Ordinal);
}
}

#region PinnedVisualStudioTagHelperDescriptors
// RC1 Razor TagHelperDescriptor Snapshot
// RC2 Razor TagHelperDescriptor Snapshot
public class VisualStudioTagHelperAttributeDesignTimeDescriptor
{
public string Summary { get; set; }
Expand All @@ -141,6 +177,7 @@ private class VisualStudioTagHelperAttributeDescriptor
private string _propertyName;

public bool IsIndexer { get; set; }
public bool IsEnum { get; set; }
public bool IsStringProperty { get; set; }
public string Name
{
Expand Down

0 comments on commit 76bf9eb

Please sign in to comment.