Skip to content

Same prefixed variable name in DisplayNameAttribute displays incorrectly #2885

@fredrikeriksson

Description

@fredrikeriksson

I noticed this when trying out Reqnroll.TUnit in our tests where with similar column names in an example table resulted in incorrect test names.
This can be worked around by either changing casing of the similar prefix substring or of course change it alltogether.
Although Reqnroll seems to enforce casings of the generated code in some cases so this doesn't always work from an Reqnroll perspective, for example if the preceding word ends with an digit.

Repro:

[Test]
[DisplayName("Test this($someValue, $someValueType)")]
[Arguments(100, "Type1")]
[Arguments(200, "Type2")]
[Arguments(300, "Type1")]
public async Task Repro(int someValue, string someValueType)
{

}

Expected result:

Test this(100, Type1)
Test this(200, Type2)
Test this(300, Type1)

Actual result:

Test this(100, 100Type)
Test this(200, 200Type)
Test this(300, 300Type)

Working example and workaround:

[Test]
[DisplayName("Test this($someValue, $somevalueType)")]
[Arguments(100, "Type1")]
[Arguments(200, "Type2")]
[Arguments(300, "Type1")]
public async Task Repro(int someValue, string somevalueType)
{

}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions