Repository: dotnet/roslyn
File: src/VisualStudio/CSharp/Test/CallHierarchy/CSharpCallHierarchyTests.cs (C#)

Code before:
        testState.VerifyResult(root, string.Format(EditorFeaturesResources.Calls_To_0, "set_Property"), ["N.C.M()"]);
    }

    [WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/77327")]
    public async Task PrimaryConstructor()
    {
        var code = """
            public class $$Class1(string test)
            {
            }

            class D
            {
                public void M()
                {
                    var c = new Class1("test");
                }
            }
            """;
        using var testState = CallHierarchyTestState.Create(code);
        var root = await testState.GetRootAsync();
        testState.VerifyRoot(root, "Class1.Class1(string)", [string.Format(EditorFeaturesResources.Calls_To_0, ".ctor")]);
        testState.VerifyResult(root, string.Format(EditorFeaturesResources.Calls_To_0, ".ctor"), ["D.M()"]);
    }

    [WpfFact]
    public async Task Method_ExcludeNameofReferencesWithoutMemberAccess()
    {
        var text = """
            namespace N
            {
                class G
                {
                    void B$$oo()
                    {
                    }

                    void Main()
                    {
                        var g = new G();
                        g.Boo(); // This should appear in call hierarchy
                    }

                    void TestNameof()
                    {
                        var methodName = nameof(Boo); // This should NOT appear
                    }
                }
            }
            """;
        using var testState = CallHierarchyTestState.Create(text);

Review comment (bug):
For tests added due to bug fixes we add a WorkItem attribute with a link to the issue.

```suggestion
    [WpfFact]
    [WorkItem("https://github.com/dotnet/roslyn/issues/71068")]
```

Code after:
        testState.VerifyResult(root, string.Format(EditorFeaturesResources.Calls_To_0, "set_Property"), ["N.C.M()"]);
    }

    [WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/77327")]
    public async Task PrimaryConstructor()
    {
        var code = """
            public class $$Class1(string test)
            {
            }

            class D
            {
                public void M()
                {
                    var c = new Class1("test");
                }
            }
            """;
        using var testState = CallHierarchyTestState.Create(code);
        var root = await testState.GetRootAsync();
        testState.VerifyRoot(root, "Class1.Class1(string)", [string.Format(EditorFeaturesResources.Calls_To_0, ".ctor")]);
        testState.VerifyResult(root, string.Format(EditorFeaturesResources.Calls_To_0, ".ctor"), ["D.M()"]);
    }

    [WpfFact]
    [WorkItem("https://github.com/dotnet/roslyn/issues/71068")]
    public async Task Method_ExcludeNameofReferencesWithoutMemberAccess()
    {
        var text = """
            namespace N
            {
                class G
                {
                    void B$$oo()
                    {
                    }

                    void Main()
                    {
                        var g = new G();
                        g.Boo(); // This should appear in call hierarchy
                    }

                    void TestNameof()
                    {
                        var methodName = nameof(Boo); // This should NOT appear
                    }
                }
            }
            """;