@@ -53,19 +53,33 @@ public async Task VerifySettingsAreReadCorrectlyAsync()
5353 ""settings"": {
5454 ""documentationRules"": {
5555 ""companyName"": ""TestCompany"",
56- ""copyrightText"": ""Custom copyright text.""
56+ ""copyrightText"": ""Custom copyright text."",
57+ ""documentationCulture"": ""ru-RU"",
58+ ""unrecognizedValue"": 3
5759 },
5860 ""namingRules"": {
59- ""allowCommonHungarianPrefixes"": false,
60- ""allowedHungarianPrefixes"": [""a"", ""ab""]
61+ ""allowCommonHungarianPrefixes"": false,
62+ ""allowedHungarianPrefixes"": [""a"", ""ab"", ""ignoredTooLong""],
63+ ""unrecognizedValue"": 3
6164 },
6265 ""layoutRules"": {
63- ""newlineAtEndOfFile"": ""require""
66+ ""newlineAtEndOfFile"": ""require"",
67+ ""unrecognizedValue"": 3
6468 },
6569 ""orderingRules"": {
66- ""usingDirectivesPlacement"": ""outsideNamespace"",
67- ""blankLinesBetweenUsingGroups"": ""omit"",
68- }
70+ ""usingDirectivesPlacement"": ""outsideNamespace"",
71+ ""blankLinesBetweenUsingGroups"": ""omit"",
72+ ""unrecognizedValue"": 3
73+ },
74+ ""maintainabilityRules"": {
75+ ""unrecognizedValue"": 3
76+ },
77+ ""indentation"": {
78+ ""unrecognizedValue"": 3
79+ },
80+ ""readabilityRules"": { },
81+ ""spacingRules"": { },
82+ ""unrecognizedValue"": 3
6983 }
7084}
7185" ;
@@ -75,6 +89,7 @@ public async Task VerifySettingsAreReadCorrectlyAsync()
7589
7690 Assert . Equal ( "TestCompany" , styleCopSettings . DocumentationRules . CompanyName ) ;
7791 Assert . Equal ( "Custom copyright text." , styleCopSettings . DocumentationRules . GetCopyrightText ( "unused" ) ) ;
92+ Assert . Equal ( "ru-RU" , styleCopSettings . DocumentationRules . DocumentationCulture ) ;
7893 Assert . False ( styleCopSettings . NamingRules . AllowCommonHungarianPrefixes ) ;
7994 Assert . Equal ( new [ ] { "a" , "ab" } , styleCopSettings . NamingRules . AllowedHungarianPrefixes ) ;
8095
@@ -86,6 +101,69 @@ public async Task VerifySettingsAreReadCorrectlyAsync()
86101 Assert . Equal ( OptionSetting . Omit , styleCopSettings . OrderingRules . BlankLinesBetweenUsingGroups ) ;
87102 }
88103
104+ /// <summary>
105+ /// Verifies that the settings are properly read.
106+ /// </summary>
107+ /// <param name="value">The value for testing the settings.</param>
108+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
109+ [ Theory ]
110+ [ InlineData ( true ) ]
111+ [ InlineData ( false ) ]
112+ public async Task VerifyBooleanDocumentationSettingsAsync ( bool value )
113+ {
114+ string valueText = value . ToString ( ) . ToLowerInvariant ( ) ;
115+ var settings = $@ "
116+ {{
117+ ""settings"": {{
118+ ""documentationRules"": {{
119+ ""documentExposedElements"": { valueText } ,
120+ ""documentInternalElements"": { valueText } ,
121+ ""documentPrivateElements"": { valueText } ,
122+ ""documentInterfaces"": { valueText } ,
123+ ""documentPrivateFields"": { valueText }
124+ }}
125+ }}
126+ }}
127+ " ;
128+ var context = await CreateAnalysisContextAsync ( settings ) . ConfigureAwait ( false ) ;
129+
130+ var styleCopSettings = context . GetStyleCopSettings ( CancellationToken . None ) ;
131+
132+ Assert . Equal ( value , styleCopSettings . DocumentationRules . DocumentExposedElements ) ;
133+ Assert . Equal ( value , styleCopSettings . DocumentationRules . DocumentInternalElements ) ;
134+ Assert . Equal ( value , styleCopSettings . DocumentationRules . DocumentPrivateElements ) ;
135+ Assert . Equal ( value , styleCopSettings . DocumentationRules . DocumentInterfaces ) ;
136+ Assert . Equal ( value , styleCopSettings . DocumentationRules . DocumentPrivateFields ) ;
137+ }
138+
139+ /// <summary>
140+ /// Verifies that the settings are properly read.
141+ /// </summary>
142+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
143+ [ Fact ]
144+ public async Task VerifyDocumentationVariablesAsync ( )
145+ {
146+ var settings = @"
147+ {
148+ ""settings"": {
149+ ""documentationRules"": {
150+ ""variables"": {
151+ ""var"": ""value"",
152+ ""no space allowed"": ""value""
153+ }
154+ }
155+ }
156+ }
157+ " ;
158+ var context = await CreateAnalysisContextAsync ( settings ) . ConfigureAwait ( false ) ;
159+
160+ var styleCopSettings = context . GetStyleCopSettings ( CancellationToken . None ) ;
161+
162+ Assert . Equal ( 1 , styleCopSettings . DocumentationRules . Variables . Count ) ;
163+ Assert . Equal ( "value" , styleCopSettings . DocumentationRules . Variables [ "var" ] ) ;
164+ Assert . False ( styleCopSettings . DocumentationRules . Variables . ContainsKey ( "no space allowed" ) ) ;
165+ }
166+
89167 /// <summary>
90168 /// Verifies that the settings will use the read company name in the default copyright text.
91169 /// </summary>
0 commit comments