Skip to content

Commit ade62fd

Browse files
committed
Additional Markdown tests
1 parent 58529d4 commit ade62fd

1 file changed

Lines changed: 60 additions & 4 deletions

File tree

DocumentationAnalyzers/DocumentationAnalyzers.Test/RefactoringRules/DOC900UnitTests.cs

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,53 @@ class TestClass { }
3838
await VerifyCodeFixAsync(testCode, fixedCode);
3939
}
4040

41+
[Fact]
42+
public async Task TestSingleParagraphSummaryAsync()
43+
{
44+
var testCode = @"
45+
///$$ <summary>
46+
/// Para 1
47+
/// </summary>
48+
class TestClass { }
49+
";
50+
var fixedCode = testCode;
51+
52+
await VerifyCodeFixAsync(testCode, fixedCode);
53+
}
54+
55+
[Fact]
56+
public async Task TestSingleParagraphRemarksAsync()
57+
{
58+
var testCode = @"
59+
///$$ <remarks>
60+
/// Para 1
61+
/// </remarks>
62+
class TestClass { }
63+
";
64+
var fixedCode = @"
65+
///$$ <remarks>
66+
/// <para>Para 1</para>
67+
/// </remarks>
68+
class TestClass { }
69+
";
70+
71+
await VerifyCodeFixAsync(testCode, fixedCode);
72+
}
73+
74+
[Fact]
75+
public async Task TestParamElementNotRenderedAsync()
76+
{
77+
var testCode = @"
78+
class TestClass {
79+
///$$ <param name=""param"">Provide a value for `param`.</param>
80+
void Method(int param) { }
81+
}
82+
";
83+
var fixedCode = testCode;
84+
85+
await VerifyCodeFixAsync(testCode, fixedCode);
86+
}
87+
4188
[Fact]
4289
public async Task TestBulletedListAsync()
4390
{
@@ -180,16 +227,25 @@ void Method<T2>() { }
180227

181228
private static async Task VerifyCodeFixAsync(string testCode, string fixedCode)
182229
{
230+
int iterations;
231+
if (testCode == fixedCode)
232+
{
233+
iterations = 1;
234+
}
235+
else
236+
{
237+
// One iteration per documentation comment fully renders the documentation. An addition iteration offers
238+
// a code fix to render documentation, but no changes are made by the fix so the iterations stop.
239+
iterations = testCode.Split(new[] { "$$" }, StringSplitOptions.None).Length;
240+
}
241+
183242
await new CSharpCodeFixTest<DOC900RenderAsMarkdown, DOC900CodeFixProvider, XUnitVerifier>
184243
{
185244
TestCode = testCode,
186245
FixedCode = fixedCode,
187246
FixedState = { MarkupHandling = MarkupMode.Allow },
188247
BatchFixedState = { MarkupHandling = MarkupMode.Allow },
189-
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,
248+
NumberOfIncrementalIterations = iterations,
193249
}.RunAsync();
194250
}
195251
}

0 commit comments

Comments
 (0)