1
1
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2
2
// Licensed under the MIT License. See LICENSE in the project root for license information.
3
3
4
- #nullable disable
5
-
6
4
namespace StyleCop . Analyzers . Test . DocumentationRules
7
5
{
8
6
using System . Threading ;
@@ -962,10 +960,32 @@ public interface ITest
962
960
await VerifyCSharpDiagnosticAsync ( testCode , testSettings , expectedResult , CancellationToken . None ) . ConfigureAwait ( false ) ;
963
961
}
964
962
963
+ [ Theory ]
964
+ [ InlineData ( "<" ) ]
965
+ [ InlineData ( "&" ) ]
966
+ [ InlineData ( """ ) ]
967
+ [ WorkItem ( 3802 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3802" ) ]
968
+ public async Task TestSentenceEndingWithXmlEntityAsync ( string xmlEntity )
969
+ {
970
+ var testCode = $@ "
971
+ /// <summary>Something { xmlEntity } [|<|]/summary>
972
+ public class TestClass
973
+ {{
974
+ }}" ;
975
+
976
+ var fixedTestCode = $@ "
977
+ /// <summary>Something { xmlEntity } .</summary>
978
+ public class TestClass
979
+ {{
980
+ }}" ;
981
+
982
+ await VerifyCSharpFixAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , fixedTestCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
983
+ }
984
+
965
985
private static Task VerifyCSharpDiagnosticAsync ( string source , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
966
986
=> VerifyCSharpDiagnosticAsync ( source , testSettings : null , expected , cancellationToken ) ;
967
987
968
- private static Task VerifyCSharpDiagnosticAsync ( string source , string testSettings , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
988
+ private static Task VerifyCSharpDiagnosticAsync ( string source , string ? testSettings , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
969
989
{
970
990
var test = CreateTest ( testSettings , expected ) ;
971
991
test . TestCode = source ;
@@ -985,7 +1005,7 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
985
1005
return test . RunAsync ( cancellationToken ) ;
986
1006
}
987
1007
988
- private static StyleCopCodeFixVerifier < SA1629DocumentationTextMustEndWithAPeriod , SA1629CodeFixProvider > . CSharpTest CreateTest ( string testSettings , DiagnosticResult [ ] expected )
1008
+ private static StyleCopCodeFixVerifier < SA1629DocumentationTextMustEndWithAPeriod , SA1629CodeFixProvider > . CSharpTest CreateTest ( string ? testSettings , DiagnosticResult [ ] expected )
989
1009
{
990
1010
string contentClassInheritDoc = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
991
1011
<TestClass>
0 commit comments