@@ -177,47 +177,42 @@ public int Property
177177 }
178178
179179 /// <summary>
180- /// Verifies that an incomplete summary tag (with only get or set, when get and set are needed) will be fixed
181- /// correctly. Regression test for #2098.
180+ /// Verifies that an incorrect summary tag with a known prefix will be fixed correctly.
182181 /// </summary>
182+ /// <param name="accessibility">The accessibility of the property.</param>
183+ /// <param name="type">The type to use for the property.</param>
184+ /// <param name="accessors">The accessors for the property.</param>
185+ /// <param name="summaryPrefix">The summary prefix used in the test code.</param>
186+ /// <param name="expectedArgument">The expected argument for the diagnostic message.</param>
183187 /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
184- [ Fact ]
185- public async Task IncompleteSummaryTagShouldBeFixedCorrectlyAsync ( )
188+ [ Theory ]
189+ [ InlineData ( "public" , "int" , "{ get; set; }" , "Gets" , "Gets or sets" ) ] // Regression test for #2098
190+ [ InlineData ( "public" , "int" , "{ get; set; }" , "Sets" , "Gets or sets" ) ] // Regression test for #2098
191+ public async Task IncorrectSummaryTagWithKnownPrefixShouldBeFixedCorrectlyAsync ( string accessibility , string type , string accessors , string summaryPrefix , string expectedArgument )
186192 {
187- var testCode = @"
193+ var testCode = $ @ "
188194public class TestClass
189- {
190- /// <summary>
191- /// Gets the first test value.
192- /// </summary>
193- public int TestProperty1 { get; set; }
194-
195+ {{
195196 /// <summary>
196- /// Sets the seconds test value.
197+ /// { summaryPrefix } the value.
197198 /// </summary>
198- public int TestProperty2 { get; set; }
199- }
199+ { accessibility } { type } TestProperty { accessors }
200+ }}
200201" ;
201202
202- var fixedTestCode = @"
203+ var fixedTestCode = $ @ "
203204public class TestClass
204- {
205- /// <summary>
206- /// Gets or sets the first test value.
207- /// </summary>
208- public int TestProperty1 { get; set; }
209-
205+ {{
210206 /// <summary>
211- /// Gets or sets the seconds test value.
207+ /// { expectedArgument } the value.
212208 /// </summary>
213- public int TestProperty2 { get; set; }
214- }
209+ { accessibility } { type } TestProperty { accessors }
210+ }}
215211" ;
216212
217213 DiagnosticResult [ ] expected =
218214 {
219- this . CSharpDiagnostic ( PropertySummaryDocumentationAnalyzer . SA1623Descriptor ) . WithLocation ( 7 , 16 ) . WithArguments ( "Gets or sets" ) ,
220- this . CSharpDiagnostic ( PropertySummaryDocumentationAnalyzer . SA1623Descriptor ) . WithLocation ( 12 , 16 ) . WithArguments ( "Gets or sets" ) ,
215+ this . CSharpDiagnostic ( PropertySummaryDocumentationAnalyzer . SA1623Descriptor ) . WithLocation ( 7 , 7 + accessibility . Length + type . Length ) . WithArguments ( expectedArgument ) ,
221216 } ;
222217
223218 await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
0 commit comments