Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataRow DisplayName is not generated properly in .NET Framework when using null values #284

Closed
Mertsch opened this issue Oct 9, 2017 · 1 comment

Comments

@Mertsch
Copy link
Contributor

Mertsch commented Oct 9, 2017

Steps to reproduce

Run this test in .NET Framework 4.6.1 mode

[TestClass]
public class UnitTest1
{
    [TestMethod]
    [DataRow("OK", "OK Test")]
    [DataRow("OK1", "OK1 Test")]
    [DataRow(null, " Test")]
    public void TestMethod1(string input, string output)
    {
        Assert.AreEqual(output, $"{input} Test");
    }
}

Expected behavior

Should output the same display name as in .NET Core

Actual behavior

image
And even worse with multiple null tests
image

Environment

VS 2017 15.3.5
.NET Core 2.0 / .NET Framework 4.6.1

<package id="MSTest.TestAdapter" version="1.2.0-beta3" targetFramework="net461" />
<package id="MSTest.TestFramework" version="1.2.0-beta3" targetFramework="net461" />
@jayaranigarg
Copy link
Member

jayaranigarg commented Nov 2, 2017

This is essentially an issue with string.join(String separator, object[] values).

If first value is null like in [DataRow(null, " Test")] , both .net framework and net core used to return an empty string earlier. But this issue got fixed in netcore to return (,Test) refer this. However, it appears that the same fix is not yet ported to .net framework and hence we are observing a difference in behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants