Skip to content

Add analyzer for duplicate test method attribute #7041

@Youssef1313

Description

@Youssef1313

The following code will compile successfully:

public class MyTestMethod : TestMethodAttribute
{
    public MyTestMethod([CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = -1) : base(callerFilePath, callerLineNumber)
    {
    }
}

[TestClass]
public class MyTestClass
{
    [TestMethod]
    [MyTestMethod]
    public void M() { }
}

We should produce a warning so that user picks one of the two attributes.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions