@@ -200,12 +200,75 @@ Dim oRange As Object
200
200
201
201
[ Test ]
202
202
[ Category ( "Inspections" ) ]
203
- public void InspectionName ( )
203
+ public void HungarianNotation_DoesNotReturnResult_Ignored ( )
204
204
{
205
- const string inspectionName = "UseMeaningfulNameInspection" ;
206
- var inspection = new UseMeaningfulNameInspection ( null , null ) ;
205
+ const string inputCode =
206
+ @"Sub Hungarian()
207
+ '@Ignore HungarianNotation
208
+ Dim oFoo As Object
209
+ End Sub" ;
210
+
211
+ var builder = new MockVbeBuilder ( ) ;
212
+ var project = builder . ProjectBuilder ( "VBAProject" , ProjectProtection . Unprotected )
213
+ . AddComponent ( "MyClass" , ComponentType . ClassModule , inputCode )
214
+ . Build ( ) ;
215
+ var vbe = builder . AddProject ( project ) . Build ( ) ;
216
+
217
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
218
+ {
219
+ var inspection = new HungarianNotationInspection ( state , UseMeaningfulNameInspectionTests . GetInspectionSettings ( ) . Object ) ;
220
+ var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
221
+
222
+ Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
223
+ }
224
+ }
225
+
226
+ [ Test ]
227
+ [ Category ( "Inspections" ) ]
228
+ public void HungarianNotation_DoesNotReturnResult_LibraryFunctionParameters ( )
229
+ {
230
+ const string inputCode =
231
+ @"
232
+ Private Declare Function GetUserName Lib ""advapi32.dll"" Alias ""GetUserNameA"" (ByVal lpBuffer As String, nSize As Long) As Long
233
+ " ;
234
+
235
+ var builder = new MockVbeBuilder ( ) ;
236
+ var project = builder . ProjectBuilder ( "VBAProject" , ProjectProtection . Unprotected )
237
+ . AddComponent ( "MyClass" , ComponentType . ClassModule , inputCode )
238
+ . Build ( ) ;
239
+ var vbe = builder . AddProject ( project ) . Build ( ) ;
240
+
241
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
242
+ {
243
+ var inspection = new HungarianNotationInspection ( state , UseMeaningfulNameInspectionTests . GetInspectionSettings ( ) . Object ) ;
244
+ var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
207
245
208
- Assert . AreEqual ( inspectionName , inspection . Name ) ;
246
+ Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
247
+ }
248
+ }
249
+
250
+ [ Test ]
251
+ [ Category ( "Inspections" ) ]
252
+ public void HungarianNotation_DoesNotReturnResult_LibraryFunction ( )
253
+ {
254
+ const string inputCode =
255
+ @"
256
+ Private Declare Sub chkVoid Lib ""somelib.dll"" Alias ""chkVoidA"" (number As Long)
257
+ " ;
258
+
259
+ var builder = new MockVbeBuilder ( ) ;
260
+ var project = builder . ProjectBuilder ( "VBAProject" , ProjectProtection . Unprotected )
261
+ . AddComponent ( "MyClass" , ComponentType . ClassModule , inputCode )
262
+ . Build ( ) ;
263
+ var vbe = builder . AddProject ( project ) . Build ( ) ;
264
+
265
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
266
+ {
267
+ var inspection = new HungarianNotationInspection ( state , UseMeaningfulNameInspectionTests . GetInspectionSettings ( ) . Object ) ;
268
+ var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
269
+
270
+ Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
271
+ }
209
272
}
210
273
}
211
274
}
0 commit comments