11// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22// Licensed under the MIT License. See LICENSE in the project root for license information.
33
4- #nullable disable
5-
64namespace StyleCop . Analyzers . Test . DocumentationRules
75{
86 using System . Threading ;
@@ -962,10 +960,32 @@ public interface ITest
962960 await VerifyCSharpDiagnosticAsync ( testCode , testSettings , expectedResult , CancellationToken . None ) . ConfigureAwait ( false ) ;
963961 }
964962
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+
965985 private static Task VerifyCSharpDiagnosticAsync ( string source , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
966986 => VerifyCSharpDiagnosticAsync ( source , testSettings : null , expected , cancellationToken ) ;
967987
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 )
969989 {
970990 var test = CreateTest ( testSettings , expected ) ;
971991 test . TestCode = source ;
@@ -985,7 +1005,7 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
9851005 return test . RunAsync ( cancellationToken ) ;
9861006 }
9871007
988- private static StyleCopCodeFixVerifier < SA1629DocumentationTextMustEndWithAPeriod , SA1629CodeFixProvider > . CSharpTest CreateTest ( string testSettings , DiagnosticResult [ ] expected )
1008+ private static StyleCopCodeFixVerifier < SA1629DocumentationTextMustEndWithAPeriod , SA1629CodeFixProvider > . CSharpTest CreateTest ( string ? testSettings , DiagnosticResult [ ] expected )
9891009 {
9901010 string contentClassInheritDoc = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
9911011<TestClass>
0 commit comments