@@ -159,138 +159,157 @@ public void TestToTypeReferenceGenericType()
159159 public void ParseReflectionName ( )
160160 {
161161 var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
162- Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Int32" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Int32" ) ) ;
163- Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Int32&" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Int32&" ) ) ;
164- Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Int32*&" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Int32*&" ) ) ;
165- Assert . That ( ReflectionHelper . ParseReflectionName ( typeof ( int ) . AssemblyQualifiedName ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Int32" ) ) ;
166- Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.String]]" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Action`1[[System.String]]" ) ) ;
167- Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.String, mscorlib]]" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Action`1[[System.String]]" ) ) ;
168- Assert . That ( ReflectionHelper . ParseReflectionName ( typeof ( int [ , ] [ , , ] ) . AssemblyQualifiedName ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Int32[,,][,]" ) ) ;
169- Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Environment+SpecialFolder" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "System.Environment+SpecialFolder" ) ) ;
162+ Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Int32" , context ) . ReflectionName , Is . EqualTo ( "System.Int32" ) ) ;
163+ Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Int32&" , context ) . ReflectionName , Is . EqualTo ( "System.Int32&" ) ) ;
164+ Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Int32*&" , context ) . ReflectionName , Is . EqualTo ( "System.Int32*&" ) ) ;
165+ Assert . That ( ReflectionHelper . ParseReflectionName ( typeof ( int ) . AssemblyQualifiedName , context ) . ReflectionName , Is . EqualTo ( "System.Int32" ) ) ;
166+ Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.String]]" , context ) . ReflectionName , Is . EqualTo ( "System.Action`1[[System.String]]" ) ) ;
167+ Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.String, mscorlib]]" , context ) . ReflectionName , Is . EqualTo ( "System.Action`1[[System.String]]" ) ) ;
168+ Assert . That ( ReflectionHelper . ParseReflectionName ( typeof ( int [ , ] [ , , ] ) . AssemblyQualifiedName , context ) . ReflectionName , Is . EqualTo ( "System.Int32[,,][,]" ) ) ;
169+ Assert . That ( ReflectionHelper . ParseReflectionName ( "System.Environment+SpecialFolder" , context ) . ReflectionName , Is . EqualTo ( "System.Environment+SpecialFolder" ) ) ;
170170 }
171171
172172 [ Test ]
173173 public void ParseOpenGenericReflectionName ( )
174174 {
175- ITypeReference typeRef = ReflectionHelper . ParseReflectionName ( "System.Converter`2[[`0],[``0]]" ) ;
176- Assert . That ( typeRef . Resolve ( new SimpleTypeResolveContext ( compilation . MainModule ) ) . ReflectionName , Is . EqualTo ( "System.Converter`2[[`0],[``0]]" ) ) ;
175+ IType converter = ReflectionHelper . ParseReflectionName ( "System.Converter`2[[`0],[``0]]" , new SimpleTypeResolveContext ( compilation . MainModule ) ) ;
176+ Assert . That ( converter . ReflectionName , Is . EqualTo ( "System.Converter`2[[`0],[``0]]" ) ) ;
177177 IMethod convertAll = compilation . FindType ( typeof ( List < > ) ) . GetMethods ( m => m . Name == "ConvertAll" ) . Single ( ) ;
178- Assert . That ( typeRef . Resolve ( new SimpleTypeResolveContext ( convertAll ) ) . ReflectionName , Is . EqualTo ( "System.Converter`2[[`0],[``0]]" ) ) ;
178+ IType converter2 = ReflectionHelper . ParseReflectionName ( "System.Converter`2[[`0],[``0]]" , new SimpleTypeResolveContext ( convertAll ) ) ;
179+ Assert . That ( converter2 . ReflectionName , Is . EqualTo ( "System.Converter`2[[`0],[``0]]" ) ) ;
179180 }
180181
181182 [ Test ]
182183 public void ArrayOfTypeParameter ( )
183184 {
184185 var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
185- Assert . That ( ReflectionHelper . ParseReflectionName ( "`0[,]" ) . Resolve ( context ) . ReflectionName , Is . EqualTo ( "`0[,]" ) ) ;
186+ Assert . That ( ReflectionHelper . ParseReflectionName ( "`0[,]" , context ) . ReflectionName , Is . EqualTo ( "`0[,]" ) ) ;
186187 }
187188
188189 [ Test ]
189190 public void ParseNullReflectionName ( )
190191 {
191- Assert . Throws < ArgumentNullException > ( ( ) => ReflectionHelper . ParseReflectionName ( null ) ) ;
192+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
193+ Assert . Throws < ArgumentNullException > ( ( ) => ReflectionHelper . ParseReflectionName ( null , context ) ) ;
192194 }
193195
194196 [ Test ]
195197 public void ParseInvalidReflectionName1 ( )
196198 {
197- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( string . Empty ) ) ;
199+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
200+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( string . Empty , context ) ) ;
198201 }
199202
200203 [ Test ]
201204 public void ParseInvalidReflectionName2 ( )
202205 {
203- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "`" ) ) ;
206+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
207+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "`" , context ) ) ;
204208 }
205209
206210 [ Test ]
207211 public void ParseInvalidReflectionName3 ( )
208212 {
209- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "``" ) ) ;
213+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
214+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "``" , context ) ) ;
210215 }
211216
212217 [ Test ]
213218 public void ParseInvalidReflectionName4 ( )
214219 {
215- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`A" ) ) ;
220+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
221+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`A" , context ) ) ;
216222 }
217223
218224 [ Test ]
219225 public void ParseInvalidReflectionName5 ( )
220226 {
221- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Environment+" ) ) ;
227+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
228+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Environment+" , context ) ) ;
222229 }
223230
224231 [ Test ]
225232 public void ParseInvalidReflectionName5b ( )
226233 {
227- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Environment+`" ) ) ;
234+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
235+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Environment+`" , context ) ) ;
228236 }
229237
230238 [ Test ]
231239 public void ParseInvalidReflectionName6 ( )
232240 {
233- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32[" ) ) ;
241+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
242+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32[" , context ) ) ;
234243 }
235244
236245 [ Test ]
237246 public void ParseInvalidReflectionName7 ( )
238247 {
239- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32[`]" ) ) ;
248+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
249+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32[`]" , context ) ) ;
240250 }
241251
242252 [ Test ]
243253 public void ParseInvalidReflectionName8 ( )
244254 {
245- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32[," ) ) ;
255+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
256+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32[," , context ) ) ;
246257 }
247258
248259 [ Test ]
249260 public void ParseInvalidReflectionName9 ( )
250261 {
251- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32]" ) ) ;
262+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
263+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32]" , context ) ) ;
252264 }
253265
254266 [ Test ]
255267 public void ParseInvalidReflectionName10 ( )
256268 {
257- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32*a" ) ) ;
269+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
270+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Int32*a" , context ) ) ;
258271 }
259272
260273 [ Test ]
261274 public void ParseInvalidReflectionName11 ( )
262275 {
263- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[]]" ) ) ;
276+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
277+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[]]" , context ) ) ;
264278 }
265279
266280 [ Test ]
267281 public void ParseInvalidReflectionName12 ( )
268282 {
269- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32]a]" ) ) ;
283+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
284+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32]a]" , context ) ) ;
270285 }
271286
272287 [ Test ]
273288 public void ParseInvalidReflectionName13 ( )
274289 {
275- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32],]" ) ) ;
290+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
291+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32],]" , context ) ) ;
276292 }
277293
278294 [ Test ]
279295 public void ParseInvalidReflectionName14 ( )
280296 {
281- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32]" ) ) ;
297+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
298+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32]" , context ) ) ;
282299 }
283300
284301 [ Test ]
285302 public void ParseInvalidReflectionName15 ( )
286303 {
287- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32" ) ) ;
304+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
305+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32" , context ) ) ;
288306 }
289307
290308 [ Test ]
291309 public void ParseInvalidReflectionName16 ( )
292310 {
293- Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32],[System.String" ) ) ;
311+ var context = new SimpleTypeResolveContext ( compilation . MainModule ) ;
312+ Assert . Throws < ReflectionNameParseException > ( ( ) => ReflectionHelper . ParseReflectionName ( "System.Action`1[[System.Int32],[System.String" , context ) ) ;
294313 }
295314 }
296315}
0 commit comments