Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit 0721187

Browse files
committed
Regression test for delegate rename
Ensure that delegate field renames causes the invocation to be renamed as well. closes #68
1 parent 9a28bc1 commit 0721187

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/PrivateFieldNamingRuleTests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,38 @@ class C
147147
Verify(text, expected, runFormatter: false);
148148
}
149149

150+
[Fact]
151+
public void Issue68()
152+
{
153+
var text = @"
154+
delegate void Action();
155+
class C
156+
{
157+
Action someAction;
158+
void M(C p)
159+
{
160+
someAction();
161+
this.someAction();
162+
p.someAction();
163+
}
164+
}";
165+
166+
var expected = @"
167+
delegate void Action();
168+
class C
169+
{
170+
Action _someAction;
171+
void M(C p)
172+
{
173+
_someAction();
174+
this._someAction();
175+
p._someAction();
176+
}
177+
}";
178+
179+
Verify(text, expected);
180+
}
181+
150182
/// <summary>
151183
/// Ensure that Roslyn properly renames private fields when accessed through a non-this
152184
/// instance within the same type.

0 commit comments

Comments
 (0)