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

Missing analyzer diagnostic when DynamicData is used with a field. #4339

Closed
Youssef1313 opened this issue Dec 13, 2024 · 0 comments · Fixed by #4383
Closed

Missing analyzer diagnostic when DynamicData is used with a field. #4339

Youssef1313 opened this issue Dec 13, 2024 · 0 comments · Fixed by #4383

Comments

@Youssef1313
Copy link
Member

    public static IEnumerable<object[]> MyProperty => new List<object[]>();

    public static IEnumerable<object[]> MyMethod() => new List<object[]>();

    public static IEnumerable<object[]> MyField;

    [TestMethod]
    [DynamicData(nameof(MyProperty), DynamicDataSourceType.Property)] // Good usage. No diagnostic.
    [DynamicData(nameof(MyMethod), DynamicDataSourceType.Property)] // Bad usage. We already produce a diagnostic.
    [DynamicData(nameof(MyField), DynamicDataSourceType.Property)] // Bad usage. We are missing a diagnostic
    public void TestMethod(object[] x)
    {

    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment