@@ -3,6 +3,7 @@ namespace ReflectionAnalyzers.Tests.Documentation
3
3
using System ;
4
4
using System . Collections . Generic ;
5
5
using System . Diagnostics ;
6
+ using System . Globalization ;
6
7
using System . IO ;
7
8
using System . Linq ;
8
9
using System . Text ;
@@ -13,7 +14,7 @@ namespace ReflectionAnalyzers.Tests.Documentation
13
14
using NUnit . Framework ;
14
15
using ReflectionAnalyzers ;
15
16
16
- public class Tests
17
+ internal class Tests
17
18
{
18
19
private static readonly IReadOnlyList < DiagnosticAnalyzer > Analyzers = typeof ( AnalyzerCategory )
19
20
. Assembly
@@ -65,11 +66,11 @@ public void Description(DescriptorInfo descriptorInfo)
65
66
{
66
67
var expected = descriptorInfo . Descriptor
67
68
. Description
68
- . ToString ( )
69
+ . ToString ( CultureInfo . InvariantCulture )
69
70
. Split ( new [ ] { "\r \n " } , StringSplitOptions . RemoveEmptyEntries )
70
71
. First ( ) ;
71
72
var actual = File . ReadLines ( descriptorInfo . DocFileName )
72
- . SkipWhile ( l => ! l . StartsWith ( "## Description" ) )
73
+ . SkipWhile ( l => ! l . StartsWith ( "## Description" , StringComparison . OrdinalIgnoreCase ) )
73
74
. Skip ( 1 )
74
75
. FirstOrDefault ( l => ! string . IsNullOrWhiteSpace ( l ) )
75
76
? . Replace ( "`" , string . Empty ) ;
@@ -130,12 +131,12 @@ private static string CreateStub(DescriptorInfo descriptorInfo)
130
131
var descriptor = descriptorInfo . Descriptor ;
131
132
var stub = Properties . Resources . DiagnosticDocTemplate
132
133
. AssertReplace ( "{ID}" , descriptor . Id )
133
- . AssertReplace ( "## ADD TITLE HERE" , $ "## { descriptor . Title . ToString ( ) } ")
134
+ . AssertReplace ( "## ADD TITLE HERE" , $ "## { descriptor . Title . ToString ( CultureInfo . InvariantCulture ) } ")
134
135
. AssertReplace ( "{SEVERITY}" , descriptor . DefaultSeverity . ToString ( ) )
135
136
. AssertReplace ( "{ENABLED}" , descriptor . IsEnabledByDefault ? "true" : "false" )
136
137
. AssertReplace ( "{CATEGORY}" , descriptor . Category )
137
- . AssertReplace ( "ADD DESCRIPTION HERE" , descriptor . Description . ToString ( ) )
138
- . AssertReplace ( "{TITLE}" , descriptor . Title . ToString ( ) ) ;
138
+ . AssertReplace ( "ADD DESCRIPTION HERE" , descriptor . Description . ToString ( CultureInfo . InvariantCulture ) )
139
+ . AssertReplace ( "{TITLE}" , descriptor . Title . ToString ( CultureInfo . InvariantCulture ) ) ;
139
140
if ( Analyzers . Count ( x => x . SupportedDiagnostics . Any ( d => d . Id == descriptor . Id ) ) == 1 )
140
141
{
141
142
return stub . AssertReplace ( "{TYPENAME}" , descriptorInfo . Analyzer . GetType ( ) . Name )
@@ -191,11 +192,6 @@ private DescriptorInfo(DiagnosticAnalyzer analyzer, DiagnosticDescriptor descrip
191
192
this . Analyzer = analyzer ;
192
193
this . Descriptor = descriptor ;
193
194
this . DocFileName = Path . Combine ( DocumentsDirectory . FullName , descriptor . Id + ".md" ) ;
194
- this . CodeFileName = Directory . EnumerateFiles (
195
- SolutionDirectory . FullName ,
196
- analyzer . GetType ( ) . Name + ".cs" ,
197
- SearchOption . AllDirectories )
198
- . FirstOrDefault ( ) ;
199
195
this . CodeFileUri = GetCodeFileUri ( analyzer ) ;
200
196
}
201
197
@@ -207,8 +203,6 @@ private DescriptorInfo(DiagnosticAnalyzer analyzer, DiagnosticDescriptor descrip
207
203
208
204
public string DocFileName { get ; }
209
205
210
- public string CodeFileName { get ; }
211
-
212
206
public string CodeFileUri { get ; }
213
207
214
208
public static string GetCodeFileUri ( DiagnosticAnalyzer analyzer )
0 commit comments