@@ -95,6 +95,93 @@ void MethodName()
9595 await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
9696 }
9797
98+ [ Fact ]
99+ public async Task TestSwitchStatementAsync ( )
100+ {
101+ string testCode = @"
102+ class ClassName
103+ {
104+ void MethodName()
105+ {
106+ switch (0)
107+ {
108+ case 0:
109+ label1:
110+ if (true)
111+ {
112+ }
113+
114+ break;
115+
116+ case 1:
117+ case 2:
118+ label2:
119+ while (true)
120+ {
121+ }
122+
123+ break;
124+
125+ default:
126+ label3a:
127+ label3b:
128+ break;
129+ }
130+ }
131+ }
132+ " ;
133+ string fixedCode = @"
134+ class ClassName
135+ {
136+ void MethodName()
137+ {
138+ switch (0)
139+ {
140+ case 0:
141+ label1:
142+ if (true)
143+ {
144+ }
145+
146+ break;
147+
148+ case 1:
149+ case 2:
150+ label2:
151+ while (true)
152+ {
153+ }
154+
155+ break;
156+
157+ default:
158+ label3a:
159+ label3b:
160+ break;
161+ }
162+ }
163+ }
164+ " ;
165+
166+ DiagnosticResult [ ] expected =
167+ {
168+ this . CSharpDiagnostic ( ) . WithLocation ( 14 , 1 ) ,
169+ this . CSharpDiagnostic ( ) . WithLocation ( 16 , 1 ) ,
170+ this . CSharpDiagnostic ( ) . WithLocation ( 17 , 1 ) ,
171+ this . CSharpDiagnostic ( ) . WithLocation ( 18 , 1 ) ,
172+ this . CSharpDiagnostic ( ) . WithLocation ( 19 , 1 ) ,
173+ this . CSharpDiagnostic ( ) . WithLocation ( 23 , 1 ) ,
174+ this . CSharpDiagnostic ( ) . WithLocation ( 25 , 1 ) ,
175+ this . CSharpDiagnostic ( ) . WithLocation ( 26 , 1 ) ,
176+ this . CSharpDiagnostic ( ) . WithLocation ( 27 , 1 ) ,
177+ this . CSharpDiagnostic ( ) . WithLocation ( 28 , 1 ) ,
178+ } ;
179+
180+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
181+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
182+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
183+ }
184+
98185 /// <inheritdoc/>
99186 protected override IEnumerable < DiagnosticAnalyzer > GetCSharpDiagnosticAnalyzers ( )
100187 {
0 commit comments