33
44namespace DocumentationAnalyzers . Test . RefactoringRules
55{
6+ using System ;
67 using System . Threading . Tasks ;
78 using DocumentationAnalyzers . RefactoringRules ;
89 using Microsoft . CodeAnalysis . CSharp . Testing ;
@@ -34,17 +35,7 @@ class TestClass { }
3435class TestClass { }
3536" ;
3637
37- await new CSharpCodeFixTest < DOC900RenderAsMarkdown , DOC900CodeFixProvider , XUnitVerifier >
38- {
39- TestCode = testCode ,
40- FixedCode = fixedCode ,
41- FixedState = { MarkupHandling = MarkupMode . Allow } ,
42- BatchFixedState = { MarkupHandling = MarkupMode . Allow } ,
43-
44- // The first iteration fully renders the documentation. The second iteration offers a code fix to render
45- // documentation, but no changes are made by the fix so the iterations stop.
46- NumberOfIncrementalIterations = 2 ,
47- } . RunAsync ( ) ;
38+ await VerifyCodeFixAsync ( testCode , fixedCode ) ;
4839 }
4940
5041 [ Fact ]
@@ -72,17 +63,7 @@ class TestClass { }
7263class TestClass { }
7364" ;
7465
75- await new CSharpCodeFixTest < DOC900RenderAsMarkdown , DOC900CodeFixProvider , XUnitVerifier >
76- {
77- TestCode = testCode ,
78- FixedCode = fixedCode ,
79- FixedState = { MarkupHandling = MarkupMode . Allow } ,
80- BatchFixedState = { MarkupHandling = MarkupMode . Allow } ,
81-
82- // The first iteration fully renders the documentation. The second iteration offers a code fix to render
83- // documentation, but no changes are made by the fix so the iterations stop.
84- NumberOfIncrementalIterations = 2 ,
85- } . RunAsync ( ) ;
66+ await VerifyCodeFixAsync ( testCode , fixedCode ) ;
8667 }
8768
8869 [ Fact ]
@@ -110,17 +91,7 @@ class TestClass { }
11091class TestClass { }
11192" ;
11293
113- await new CSharpCodeFixTest < DOC900RenderAsMarkdown , DOC900CodeFixProvider , XUnitVerifier >
114- {
115- TestCode = testCode ,
116- FixedCode = fixedCode ,
117- FixedState = { MarkupHandling = MarkupMode . Allow } ,
118- BatchFixedState = { MarkupHandling = MarkupMode . Allow } ,
119-
120- // The first iteration fully renders the documentation. The second iteration offers a code fix to render
121- // documentation, but no changes are made by the fix so the iterations stop.
122- NumberOfIncrementalIterations = 2 ,
123- } . RunAsync ( ) ;
94+ await VerifyCodeFixAsync ( testCode , fixedCode ) ;
12495 }
12596
12697 [ Fact ]
@@ -152,17 +123,7 @@ class TestClass { }
152123class TestClass { }
153124" ;
154125
155- await new CSharpCodeFixTest < DOC900RenderAsMarkdown , DOC900CodeFixProvider , XUnitVerifier >
156- {
157- TestCode = testCode ,
158- FixedCode = fixedCode ,
159- FixedState = { MarkupHandling = MarkupMode . Allow } ,
160- BatchFixedState = { MarkupHandling = MarkupMode . Allow } ,
161-
162- // The first iteration fully renders the documentation. The second iteration offers a code fix to render
163- // documentation, but no changes are made by the fix so the iterations stop.
164- NumberOfIncrementalIterations = 2 ,
165- } . RunAsync ( ) ;
126+ await VerifyCodeFixAsync ( testCode , fixedCode ) ;
166127 }
167128
168129 [ Fact ]
@@ -185,17 +146,7 @@ void Method(int param) { }
185146}
186147" ;
187148
188- await new CSharpCodeFixTest < DOC900RenderAsMarkdown , DOC900CodeFixProvider , XUnitVerifier >
189- {
190- TestCode = testCode ,
191- FixedCode = fixedCode ,
192- FixedState = { MarkupHandling = MarkupMode . Allow } ,
193- BatchFixedState = { MarkupHandling = MarkupMode . Allow } ,
194-
195- // The first iteration fully renders the documentation. The second iteration offers a code fix to render
196- // documentation, but no changes are made by the fix so the iterations stop.
197- NumberOfIncrementalIterations = 2 ,
198- } . RunAsync ( ) ;
149+ await VerifyCodeFixAsync ( testCode , fixedCode ) ;
199150 }
200151
201152 [ Fact ]
@@ -224,16 +175,21 @@ void Method<T2>() { }
224175}
225176" ;
226177
178+ await VerifyCodeFixAsync ( testCode , fixedCode ) ;
179+ }
180+
181+ private static async Task VerifyCodeFixAsync ( string testCode , string fixedCode )
182+ {
227183 await new CSharpCodeFixTest < DOC900RenderAsMarkdown , DOC900CodeFixProvider , XUnitVerifier >
228184 {
229185 TestCode = testCode ,
230186 FixedCode = fixedCode ,
231187 FixedState = { MarkupHandling = MarkupMode . Allow } ,
232188 BatchFixedState = { MarkupHandling = MarkupMode . Allow } ,
233189
234- // The first iteration fully renders the documentation. The second iteration offers a code fix to render
235- // documentation, but no changes are made by the fix so the iterations stop.
236- NumberOfIncrementalIterations = 3 ,
190+ // One iteration per documentation comment fully renders the documentation. An addition iteration offers
191+ // a code fix to render documentation, but no changes are made by the fix so the iterations stop.
192+ NumberOfIncrementalIterations = testCode . Split ( new [ ] { "$$" } , StringSplitOptions . None ) . Length ,
237193 } . RunAsync ( ) ;
238194 }
239195 }
0 commit comments