Exemplo n.º 1
0
    public void HtmlAttributePropertyHelper_ReturnsValueCorrectly()
    {
        // Arrange
        var anonymous = new { bar = "baz" };
        var property  = anonymous.GetType().GetTypeInfo().DeclaredProperties.First();

        // Act
        var helper = new HtmlAttributePropertyHelper(property);

        // Assert
        Assert.Equal("bar", helper.Name);
        Assert.Equal("baz", helper.GetValue(anonymous));
    }
Exemplo n.º 2
0
        public void HtmlAttributePropertyHelperReturnsValueCorrectlyForValueTypes()
        {
            // Arrange
            var          anonymous = new { foo = 32 };
            PropertyInfo property  = anonymous.GetType().GetProperties().First();

            // Act
            HtmlAttributePropertyHelper helper = new HtmlAttributePropertyHelper(property);

            // Assert
            Assert.Equal("foo", helper.Name);
            Assert.Equal(32, helper.GetValue(anonymous));
        }
        public void HtmlAttributePropertyHelperReturnsValueCorrectlyForValueTypes()
        {
            // Arrange
            var anonymous = new { foo = 32 };
            PropertyInfo property = anonymous.GetType().GetProperties().First();

            // Act
            HtmlAttributePropertyHelper helper = new HtmlAttributePropertyHelper(property);

            // Assert
            Assert.Equal("foo", helper.Name);
            Assert.Equal(32, helper.GetValue(anonymous));
        }