Skip to content

ComponentDesigner.PostFilterAttributes(null) throws NRE #1050

@hughbe

Description

@hughbe
public static IEnumerable<object[]> PostFilterAttributes_TestData()
{
    yield return new object[] { null, InheritanceAttribute.Default };
    yield return new object[] { new Dictionary<Type, object>(), InheritanceAttribute.Default };
    yield return new object[] { new Dictionary<Type, object> { { typeof(InheritanceAttribute), null } }, InheritanceAttribute.Default };
    yield return new object[] { new Dictionary<Type, object> { { typeof(InheritanceAttribute), new object() } }, InheritanceAttribute.Default };
    var attribute = new InheritanceAttribute();
    yield return new object[] { new Dictionary<Type, object> { { typeof(InheritanceAttribute), attribute } }, attribute };
}

[Theory]
[MemberData(nameof(PostFilterAttributes_TestData))]
public void PostFilterAttributes_HasInheritanceAttributeKey_Sets(IDictionary attributes, object expected)
{
    var designer = new SubComponentDesigner();
    designer.PostFilterAttributes(attributes);
    Assert.Same(expected, designer.InheritanceAttribute);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions