xunit/xunit

InlineData duplicate detection fails to detect duplicates between implicitly converted types

Open

#2,957 opened on Jun 22, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)C# (761 forks)batch import
AnalyzersBughelp wanted

Repository metrics

Stars
 (3,873 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Given the following code:

    public const int Const = 1;
    public const byte ConstByte = 1;

    [Theory]
    [InlineData(Const)]
    [InlineData(ConstByte)]
    public void Test(int a) { }

No diagnostics are raised by the analyzer despite both these inputs resulting in exactly the same test being run. Somewhat related to https://github.com/xunit/xunit/issues/1742, with the major difference being that these tests run just fine without any issues.

Contributor guide