Skip to content

Commit 3741760

Browse files
committed
Updated tests for invocation expressions
The tests now include parameters which contain invocations but are not themselves invocation expressions.
1 parent a52c07d commit 3741760

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1118UnitTests.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ public void Fun(int i, int j, int k)
103103
public void Bar()
104104
{
105105
Fun(1,
106-
3
107-
+ 4,
106+
System.Linq.Enumerable.Count(
107+
new int[0]) + 4,
108108
System.Linq.Enumerable.Count(
109109
new int[0]));
110110
}
@@ -182,24 +182,28 @@ public void Bar()
182182
}
183183

184184
[Fact]
185-
public async Task TestAnonymousMethodCallSecondParameterIsInvocationAsync()
185+
public async Task TestAnonymousMethodCallSecondParameterSpansMultipleLinesThirdParameterIsInvocationAsync()
186186
{
187187
var testCode = @"
188188
class Foo
189189
{
190190
public void Bar()
191191
{
192-
System.Action<int,int> d = delegate(int i, int a)
192+
System.Action<int, int, int> d = delegate(int i, int j, int k)
193193
{
194194
195195
};
196196
d(1,
197+
System.Linq.Enumerable.Count(
198+
new int[0]) + 1,
197199
System.Linq.Enumerable.Count(
198200
new int[0]));
199201
}
200202
}";
201203

202-
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
204+
DiagnosticResult expected = this.CSharpDiagnostic().WithLocation(11, 11);
205+
206+
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
203207
}
204208

205209
[Fact]

0 commit comments

Comments
 (0)