@@ -21,115 +21,26 @@ public void DefType_InspectionType()
21
21
}
22
22
23
23
[ Test ]
24
+ [ TestCase ( "Bool" ) ]
25
+ [ TestCase ( "Byte" ) ]
26
+ [ TestCase ( "Int" ) ]
27
+ [ TestCase ( "Lng" ) ]
28
+ [ TestCase ( "Cur" ) ]
29
+ [ TestCase ( "Sng" ) ]
30
+ [ TestCase ( "Dbl" ) ]
31
+ [ TestCase ( "Date" ) ]
32
+ [ TestCase ( "Str" ) ]
33
+ [ TestCase ( "Obj" ) ]
34
+ [ TestCase ( "Var" ) ]
24
35
[ Category ( "Inspections" ) ]
25
- public void DefType_Bool ( )
36
+ public void DefType_SingleResultFound ( string type )
26
37
{
27
38
const string inputCode =
28
- @"DefBool A
39
+ @"Def{0} A
29
40
Public Function aFoo()
30
41
End Function" ;
31
42
32
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
33
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
34
- {
35
- var inspection = new DefTypeStatementInspection ( state ) ;
36
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
37
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
38
-
39
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
40
- }
41
- }
42
-
43
- [ Test ]
44
- [ Category ( "Inspections" ) ]
45
- public void DefType_Byte ( )
46
- {
47
- const string inputCode =
48
- @"DefByte B
49
- Public Function bFoo()
50
- End Function" ;
51
-
52
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
53
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
54
- {
55
- var inspection = new DefTypeStatementInspection ( state ) ;
56
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
57
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
58
-
59
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
60
- }
61
- }
62
-
63
- [ Test ]
64
- [ Category ( "Inspections" ) ]
65
- public void DefType_Integer ( )
66
- {
67
- const string inputCode =
68
- @"DefInt C
69
- Public Function cFoo()
70
- End Function" ;
71
-
72
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
73
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
74
- {
75
- var inspection = new DefTypeStatementInspection ( state ) ;
76
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
77
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
78
-
79
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
80
- }
81
- }
82
-
83
- [ Test ]
84
- [ Category ( "Inspections" ) ]
85
- public void DefType_Long ( )
86
- {
87
- const string inputCode =
88
- @"DefLng D
89
- Public Function dFoo()
90
- End Function" ;
91
-
92
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
93
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
94
- {
95
- var inspection = new DefTypeStatementInspection ( state ) ;
96
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
97
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
98
-
99
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
100
- }
101
- }
102
-
103
- [ Test ]
104
- [ Category ( "Inspections" ) ]
105
- public void DefType_Currency ( )
106
- {
107
- const string inputCode =
108
- @"DefCur E
109
- Public Function eFoo()
110
- End Function" ;
111
-
112
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
113
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
114
- {
115
- var inspection = new DefTypeStatementInspection ( state ) ;
116
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
117
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
118
-
119
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
120
- }
121
- }
122
-
123
- [ Test ]
124
- [ Category ( "Inspections" ) ]
125
- public void DefType_Single ( )
126
- {
127
- const string inputCode =
128
- @"DefSng F
129
- Public Function fFoo()
130
- End Function" ;
131
-
132
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
43
+ var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( string . Format ( inputCode , type ) , out _ ) ;
133
44
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
134
45
{
135
46
var inspection = new DefTypeStatementInspection ( state ) ;
@@ -141,116 +52,27 @@ Public Function fFoo()
141
52
}
142
53
143
54
[ Test ]
55
+ [ TestCase ( "Bool" ) ]
56
+ [ TestCase ( "Byte" ) ]
57
+ [ TestCase ( "Int" ) ]
58
+ [ TestCase ( "Lng" ) ]
59
+ [ TestCase ( "Cur" ) ]
60
+ [ TestCase ( "Sng" ) ]
61
+ [ TestCase ( "Dbl" ) ]
62
+ [ TestCase ( "Date" ) ]
63
+ [ TestCase ( "Str" ) ]
64
+ [ TestCase ( "Obj" ) ]
65
+ [ TestCase ( "Var" ) ]
144
66
[ Category ( "Inspections" ) ]
145
- public void DefType_Double ( )
146
- {
147
- const string inputCode =
148
- @"DefDbl G
149
- Public Function gFoo()
150
- End Function" ;
151
-
152
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
153
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
154
- {
155
- var inspection = new DefTypeStatementInspection ( state ) ;
156
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
157
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
158
-
159
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
160
- }
161
- }
162
-
163
- [ Test ]
164
- [ Category ( "Inspections" ) ]
165
- public void DefType_Date ( )
166
- {
167
- const string inputCode =
168
- @"DefDate H
169
- Public Function hFoo()
170
- End Function" ;
171
-
172
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
173
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
174
- {
175
- var inspection = new DefTypeStatementInspection ( state ) ;
176
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
177
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
178
-
179
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
180
- }
181
- }
182
-
183
- [ Test ]
184
- [ Category ( "Inspections" ) ]
185
- public void DefType_String ( )
186
- {
187
- const string inputCode =
188
- @"DefStr I
189
- Public Function iFoo()
190
- End Function" ;
191
-
192
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
193
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
194
- {
195
- var inspection = new DefTypeStatementInspection ( state ) ;
196
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
197
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
198
-
199
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
200
- }
201
- }
202
-
203
- [ Test ]
204
- [ Category ( "Inspections" ) ]
205
- public void DefType_Object ( )
206
- {
207
- const string inputCode =
208
- @"DefObj J
209
- Public Function jFoo()
210
- End Function" ;
211
-
212
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
213
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
214
- {
215
- var inspection = new DefTypeStatementInspection ( state ) ;
216
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
217
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
218
-
219
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
220
- }
221
- }
222
-
223
- [ Test ]
224
- [ Category ( "Inspections" ) ]
225
- public void DefType_Variant ( )
226
- {
227
- const string inputCode =
228
- @"DefVar K
229
- Public Function kFoo()
230
- End Function" ;
231
-
232
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
233
- using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
234
- {
235
- var inspection = new DefTypeStatementInspection ( state ) ;
236
- var inspector = InspectionsHelper . GetInspector ( inspection ) ;
237
- var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
238
-
239
- Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
240
- }
241
- }
242
-
243
- [ Test ]
244
- [ Category ( "Inspections" ) ]
245
- public void DefType_SingleResultIgnored ( )
67
+ public void DefType_SingleResultIgnored ( string type )
246
68
{
247
69
const string inputCode =
248
70
@"'@Ignore DefTypeStatement
249
- DefInt F
71
+ Def{0} F
250
72
Public Function FunctionWontBeFoundInResult()
251
73
End Function" ;
252
74
253
- var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
75
+ var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( string . Format ( inputCode , type ) , out _ ) ;
254
76
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
255
77
{
256
78
var inspection = new DefTypeStatementInspection ( state ) ;
0 commit comments