public void HtmlAttributePropertyHelper_ReturnsCachedPropertyHelper() { // Arrange var anonymous = new { foo = "bar" }; // Act var helpers1 = HtmlAttributePropertyHelper.GetProperties(anonymous.GetType()); var helpers2 = HtmlAttributePropertyHelper.GetProperties(anonymous.GetType()); // Assert Assert.Equal(1, helpers1.Length); Assert.Same(helpers1, helpers2); Assert.Same(helpers1[0], helpers2[0]); }
public void HtmlAttributePropertyHelper_DoesNotShareCacheWithPropertyHelper() { // Arrange var anonymous = new { bar_baz1 = "foo" }; // Act var helpers1 = HtmlAttributePropertyHelper.GetProperties(anonymous.GetType()); var helpers2 = PropertyHelper.GetProperties(anonymous.GetType()); // Assert Assert.Equal(1, helpers1.Length); Assert.Equal(1, helpers2.Length); Assert.NotEqual <PropertyHelper[]>(helpers1, helpers2); Assert.NotEqual <PropertyHelper>(helpers1[0], helpers2[0]); Assert.IsType <HtmlAttributePropertyHelper>(helpers1[0]); Assert.IsNotType <HtmlAttributePropertyHelper>(helpers2[0]); Assert.Equal("bar-baz1", helpers1[0].Name); Assert.Equal("bar_baz1", helpers2[0].Name); }