Skip to content

Commit 297d44c

Browse files
author
David Grieser
committed
Moved 'TestJoinIntoClauseSyntaxQueryExpressionAsync' test case
1 parent 390b565 commit 297d44c

File tree

2 files changed

+67
-72
lines changed

2 files changed

+67
-72
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp12/LayoutRules/SA1513CSharp12UnitTests.cs

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace StyleCop.Analyzers.Test.CSharp12.LayoutRules
88
using Microsoft.CodeAnalysis.Testing;
99
using StyleCop.Analyzers.Test.CSharp11.LayoutRules;
1010
using Xunit;
11-
1211
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1312
StyleCop.Analyzers.LayoutRules.SA1513ClosingBraceMustBeFollowedByBlankLine,
1413
StyleCop.Analyzers.LayoutRules.SA1513CodeFixProvider>;
@@ -32,76 +31,5 @@ public Foo[] TestMethod() =>
3231

3332
await VerifyCSharpFixAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
3433
}
35-
36-
[Fact]
37-
public async Task TestJoinIntoClauseSyntaxQueryExpressionAsync()
38-
{
39-
var testCode = @"
40-
using System.Collections.Generic;
41-
using System.Linq;
42-
43-
public class JoinIntoClauseSyntaxQueryExpressionTest
44-
{
45-
public JoinIntoClauseSyntaxQueryExpressionTest()
46-
{
47-
List<Foo> fooList =
48-
[
49-
new(1, ""First""),
50-
new(2, ""Second""),
51-
new(3, ""Third""),
52-
new(1, ""Fourth"")
53-
];
54-
55-
List<Bar> barList =
56-
[
57-
new(1, ""First""),
58-
new(2, ""Second""),
59-
new(3, ""Third"")
60-
];
61-
62-
var query =
63-
from foo in fooList
64-
join bar in barList
65-
on new
66-
{
67-
foo.Id,
68-
foo.Name
69-
}
70-
equals new
71-
{
72-
bar.Id,
73-
bar.Name
74-
}
75-
into grouping
76-
from joined in grouping.DefaultIfEmpty()
77-
select new
78-
{
79-
joined.Id,
80-
BarName = joined.Name,
81-
FooName = foo.Name
82-
};
83-
}
84-
85-
private class Foo(
86-
int id,
87-
string name)
88-
{
89-
public int Id { get; } = id;
90-
91-
public string Name { get; } = name;
92-
}
93-
94-
private class Bar(
95-
int id,
96-
string name)
97-
{
98-
public int Id { get; } = id;
99-
100-
public string Name { get; } = name;
101-
}
102-
}";
103-
104-
await VerifyCSharpFixAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
105-
}
10634
}
10735
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/LayoutRules/SA1513UnitTests.cs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,5 +1034,72 @@ public class TestClass
10341034

10351035
await VerifyCSharpFixAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, fixedCode, CancellationToken.None).ConfigureAwait(false);
10361036
}
1037+
1038+
[Fact]
1039+
public async Task TestJoinIntoClauseSyntaxQueryExpressionAsync()
1040+
{
1041+
var testCode = @"
1042+
using System.Collections.Generic;
1043+
using System.Linq;
1044+
1045+
public class JoinIntoClauseSyntaxQueryExpressionTest
1046+
{
1047+
public JoinIntoClauseSyntaxQueryExpressionTest()
1048+
{
1049+
List<Foo> fooList = new List<Foo>();
1050+
List<Bar> barList = new List<Bar>();
1051+
1052+
var query =
1053+
from foo in fooList
1054+
join bar in barList
1055+
on new
1056+
{
1057+
foo.Id,
1058+
foo.Name
1059+
}
1060+
equals new
1061+
{
1062+
bar.Id,
1063+
bar.Name
1064+
}
1065+
into grouping
1066+
from joined in grouping.DefaultIfEmpty()
1067+
select new
1068+
{
1069+
joined.Id,
1070+
BarName = joined.Name,
1071+
FooName = foo.Name
1072+
};
1073+
}
1074+
1075+
private class Foo
1076+
{
1077+
public Foo(int id, string name)
1078+
{
1079+
this.Id = id;
1080+
this.Name = name;
1081+
}
1082+
1083+
public int Id { get; }
1084+
1085+
public string Name { get; }
1086+
}
1087+
1088+
private class Bar
1089+
{
1090+
public Bar(int id, string name)
1091+
{
1092+
this.Id = id;
1093+
this.Name = name;
1094+
}
1095+
1096+
public int Id { get; }
1097+
1098+
public string Name { get; }
1099+
}
1100+
}";
1101+
1102+
await VerifyCSharpFixAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
1103+
}
10371104
}
10381105
}

0 commit comments

Comments
 (0)