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

Code before:
                    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);
        var root = await testState.GetRootAsync();
        testState.VerifyRoot(root, "N.G.Boo()", [string.Format(EditorFeaturesResources.Calls_To_0, "Boo")]);
        // Only the actual method call should appear, not the nameof reference
        testState.VerifyResult(root, string.Format(EditorFeaturesResources.Calls_To_0, "Boo"), ["N.G.Main()"]);
    }

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

                class G
                {
                    void Main()
                    {
                        var c = new C();
                        c.Goo(); // This should appear in call hierarchy
                    }

                    void TestNameof()
                    {
                        var methodName = nameof(C.Goo); // This should NOT appear
                    }
                }
            }

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:
                {
                    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);
        var root = await testState.GetRootAsync();
        testState.VerifyRoot(root, "N.G.Boo()", [string.Format(EditorFeaturesResources.Calls_To_0, "Boo")]);
        // Only the actual method call should appear, not the nameof reference
        testState.VerifyResult(root, string.Format(EditorFeaturesResources.Calls_To_0, "Boo"), ["N.G.Main()"]);
    }

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

                class G
                {
                    void Main()
                    {
                        var c = new C();
                        c.Goo(); // This should appear in call hierarchy
                    }

                    void TestNameof()
                    {
                        var methodName = nameof(C.Goo); // This should NOT appear
                    }