Skip to content

Improve display name when DataRow contains arrays #1333

@Evangelink

Description

@Evangelink

Summary

When the DataRowAttribute contains multiple items including at least one array, then the display name will display the type instead of unwrapping the values.

Example

public void GetDisplayNameForMultipleArraysOfOneItem()
{
	// Arrange
	var dataRow = new DataRowAttribute(new[] { "a" }, new[] { "1" });
	var methodInfoMock = new Mock<MethodInfo>();
	methodInfoMock.SetupGet(x => x.Name).Returns("MyMethod");

	// Act
	var displayName = dataRow.GetDisplayName(methodInfoMock.Object, dataRow.Data);

	// Assert
	Verify(displayName == "MyMethod (System.String[],System.String[])"); // Expecting `MyMethod ([a],[1])`
}

public void GetDisplayNameForMultipleArraysOfMultipleItems()
{
	// Arrange
	var dataRow = new DataRowAttribute(new[] { "a", "b", "c" }, new[] { "1", "2", "3" });
	var methodInfoMock = new Mock<MethodInfo>();
	methodInfoMock.SetupGet(x => x.Name).Returns("MyMethod");

	// Act
	var displayName = dataRow.GetDisplayName(methodInfoMock.Object, dataRow.Data);

	// Assert
	Verify(displayName == "MyMethod (System.String[],System.String[])"); // Expecting `MyMethod ([a,b,c],[1,2,3])`
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions