2010-01-20 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / corlib / Test / System / TypeTest.cs
1 // TypeTest.cs - NUnit Test Cases for the System.Type class
2 //
3 // Authors:
4 //      Zoltan Varga (vargaz@freemail.hu)
5 //  Patrik Torstensson
6 //
7 // (C) 2003 Ximian, Inc.  http://www.ximian.com
8 // 
9
10 using NUnit.Framework;
11 using System;
12 using System.Threading;
13 using System.Collections;
14 using System.Collections.Generic;
15 using System.IO;
16 using System.Reflection;
17 using System.Reflection.Emit;
18 using System.Runtime.InteropServices;
19 using System.Text;
20 using System.Globalization;
21
22 class NoNamespaceClass {
23 }
24
25 namespace MonoTests.System
26 {
27         class Super : ICloneable
28         {
29                 public virtual object Clone ()
30                 {
31                         return null;
32                 }
33         }
34
35         class Duper: Super
36         {
37         }
38
39         interface IFace1
40         {
41                 void foo ();
42         }
43
44         interface IFace2 : IFace1
45         {
46                 void bar ();
47         }
48
49         interface IFace3 : IFace2
50         {
51         }
52
53         enum TheEnum
54         {
55                 A,
56                 B,
57                 C
58         };
59
60         abstract class Base
61         {
62                 public int level;
63
64                 public abstract int this [byte i] {
65                         get;
66                 }
67
68                 public abstract int this [int i] {
69                         get;
70                 }
71
72                 public abstract void TestVoid ();
73                 public abstract void TestInt (int i);
74         }
75
76         class DeriveVTable : Base
77         {
78                 public override int this [byte i] {
79                         get { return 1; }
80                 }
81
82                 public override int this [int i] {
83                         get { return 1; }
84                 }
85
86                 public override void TestVoid ()
87                 {
88                         level = 1;
89                 }
90
91                 public override void TestInt (int i)
92                 {
93                         level = 1;
94                 }
95         }
96
97         class NewVTable : DeriveVTable
98         {
99                 public new int this [byte i] {
100                         get { return 2; }
101                 }
102
103                 public new int this [int i] {
104                         get { return 2; }
105                 }
106
107                 public new void TestVoid ()
108                 {
109                         level = 2;
110                 }
111
112                 public new void TestInt (int i)
113                 {
114                         level = 2;
115                 }
116
117                 public void Overload ()
118                 {
119                 }
120
121                 public void Overload (int i)
122                 {
123                 }
124
125                 public NewVTable (out int i)
126                 {
127                         i = 0;
128                 }
129
130                 public void byref_method (out int i)
131                 {
132                         i = 0;
133                 }
134         }
135
136         class Base1
137         {
138                 public virtual int Foo {
139                         get { return 1; }
140                         set { }
141                 }
142         }
143
144         class Derived1 : Base1
145         {
146                 public override int Foo {
147                         set { }
148                 }
149         }
150
151         class Derived2 : Base1
152         {
153                 public new int Foo {
154                         get { return 1; }
155                         set { }
156                 }
157         }
158
159         public class Foo<T>
160         {
161                 public T Whatever;
162         
163                 public T Test {
164                         get { throw new NotImplementedException (); }
165                 }
166
167                 public T Execute (T a)
168                 {
169                         return a;
170                 }
171         }
172         
173         class Foo<T, U>
174         {
175         }
176
177         public interface IBar<T>
178         {
179         }
180
181         public class Baz<T> : IBar<T>
182         {
183         }
184
185         class Gazonk {
186
187                 public static void Bang<S> () {}
188         }
189
190         public class Bug348522
191         {
192                 public void Test (int __argument)
193                 {
194                 }
195         }
196
197         public class FirstMethodBinder : Binder
198         {
199                 public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase [] match, ref object [] args,
200                                                          ParameterModifier [] modifiers, CultureInfo culture, string [] names,
201                                                          out object state)
202                 {
203                         state = null;
204                         return match [0];
205                 }
206                 
207                 public override object ChangeType (object value, Type type1, CultureInfo culture)
208                 {
209                         return value;
210                 }
211                 
212                 // The rest is just to please the compiler
213                 public override FieldInfo BindToField (BindingFlags a, FieldInfo[] b, object c, CultureInfo d)
214                 {
215                         return null;
216                 }
217                 
218                 public override void ReorderArgumentArray(ref object[] a, object b)
219                 {
220                 }
221                 
222                 public override MethodBase SelectMethod(BindingFlags a, MethodBase[] b, Type[] c, ParameterModifier[] d)
223                 {
224                     return null;
225                 }
226                 
227                 public override PropertyInfo SelectProperty(BindingFlags a, PropertyInfo[] b, Type c, Type[] d, ParameterModifier[] e)
228                 {
229                         return null;
230                 }
231         }
232
233
234         [TestFixture]
235         public class TypeTest
236         {
237                 private AssemblyBuilder assembly;
238                 private ModuleBuilder module;
239                 const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
240                 static int typeIndexer = 0;
241
242                 [SetUp]
243                 public void SetUp ()
244                 {
245                         AssemblyName assemblyName = new AssemblyName ();
246                         assemblyName.Name = ASSEMBLY_NAME;
247                         assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
248                                         assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
249                         module = assembly.DefineDynamicModule ("module1");
250                 }
251
252                 private string genTypeName ()
253                 {
254                         return "t" + (typeIndexer++);
255                 }
256
257                 private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k)
258                 {
259                 }
260
261                 private void GenericMethod<Q> (Q q)
262                 {
263                 }
264
265                 [Test]
266                 public void TestIsAssignableFrom ()
267                 {
268                         // Simple tests for inheritance
269                         Assert.AreEqual (typeof (Super).IsAssignableFrom (typeof (Duper)) , true, "#01");
270                         Assert.AreEqual (typeof (Duper).IsAssignableFrom (typeof (Duper)), true, "#02");
271                         Assert.AreEqual (typeof (Object).IsAssignableFrom (typeof (Duper)), true, "#03");
272                         Assert.AreEqual (typeof (ICloneable).IsAssignableFrom (typeof (Duper)), true, "#04");
273
274                         // Tests for arrays
275                         Assert.AreEqual (typeof (Super[]).IsAssignableFrom (typeof (Duper[])), true, "#05");
276                         Assert.AreEqual (typeof (Duper[]).IsAssignableFrom (typeof (Super[])), false, "#06");
277                         Assert.AreEqual (typeof (Object[]).IsAssignableFrom (typeof (Duper[])), true, "#07");
278                         Assert.AreEqual (typeof (ICloneable[]).IsAssignableFrom (typeof (Duper[])), true, "#08");
279
280                         // Tests for multiple dimensional arrays
281                         Assert.AreEqual (typeof (Super[][]).IsAssignableFrom (typeof (Duper[][])), true, "#09");
282                         Assert.AreEqual (typeof (Duper[][]).IsAssignableFrom (typeof (Super[][])), false, "#10");
283                         Assert.AreEqual (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])), true, "#11");
284                         Assert.AreEqual (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])), true, "#12");
285
286                         // Tests for vectors<->one dimensional arrays */
287 #if TARGET_JVM // Lower bounds arrays are not supported for TARGET_JVM.
288                         Array arr1 = Array.CreateInstance (typeof (int), new int[] {1});
289                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
290 #else
291                         Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
292                         Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
293
294                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
295                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false, "#14");
296 #endif // TARGET_JVM
297
298                         // Test that arrays of enums can be cast to their base types
299                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])), true, "#15");
300
301                         // Test that arrays of valuetypes can't be cast to arrays of
302                         // references
303                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TypeCode[])), false, "#16");
304                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TypeCode[])), false, "#17");
305                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TypeCode[])), false, "#18");
306
307                         // Test that arrays of enums can't be cast to arrays of references
308                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TheEnum[])), false, "#19");
309                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TheEnum[])), false, "#20");
310                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TheEnum[])), false, "#21");
311
312                         // Check that ValueType and Enum are recognized as reference types
313                         Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (ValueType)), true, "#22");
314                         Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (Enum)), true, "#23");
315                         Assert.AreEqual (typeof (ValueType).IsAssignableFrom (typeof (Enum)), true, "#24");
316
317                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (ValueType[])), true, "#25");
318                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (ValueType[])), true, "#26");
319                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (ValueType[])), false, "#27");
320
321                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (Enum[])), true, "#28");
322                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (Enum[])), true, "#29");
323                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (Enum[])), true, "#30");
324
325                         // Tests for byref types
326                         MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
327                         Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
328                         Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
329
330                         // Tests for type parameters
331                         mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
332                         Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
333                         Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
334                 }
335
336                 [Test]
337                 [ExpectedException (typeof (ArgumentException))]
338                 public void GetInterfaceMapOnInterface ()
339                 {
340                         typeof (IList).GetInterfaceMap (typeof (ICollection));
341                 }
342
343                 [Test]
344                 public void TestIsSubclassOf ()
345                 {
346                         Assert.IsTrue (typeof (ICloneable).IsSubclassOf (typeof (object)), "#01");
347
348                         // Tests for byref types
349                         Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
350                         Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
351                         //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
352                         Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
353                 }
354
355                 [Test]
356                 public void TestGetMethodImpl ()
357                 {
358                         // Test binding of new slot methods (using no types)
359                         Assert.AreEqual (typeof (Base), typeof (Base).GetMethod("TestVoid").DeclaringType, "#01");
360                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestVoid").DeclaringType, "#02");
361
362                         // Test binding of new slot methods (using types)
363                         Assert.AreEqual (typeof (Base), typeof (Base).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#03");
364                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#04");
365
366                         // Test overload resolution
367                         Assert.AreEqual (0, typeof (NewVTable).GetMethod ("Overload", new Type[0]).GetParameters ().Length, "#05");
368
369                         // Test byref parameters
370                         Assert.AreEqual (null, typeof (NewVTable).GetMethod ("byref_method", new Type[] { typeof (int) }), "#06");
371                         Type byrefInt = typeof (NewVTable).GetMethod ("byref_method").GetParameters ()[0].ParameterType;
372                         Assert.IsNotNull (typeof (NewVTable).GetMethod ("byref_method", new Type[] { byrefInt }), "#07");
373                 }
374
375                 [Test]
376                 [Category ("TargetJvmNotWorking")]
377                 public void TestGetPropertyImpl ()
378                 {
379                         // Test getting property that is exact
380                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int32) }).DeclaringType, "#01");
381
382                         // Test getting property that is not exact
383                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int16) }).DeclaringType, "#02");
384
385                         // Test overriding of properties when only the set accessor is overriden
386                         Assert.AreEqual (1, typeof (Derived1).GetProperties ().Length, "#03");
387                 }
388
389                 [Test]
390                 public void GetProperties ()
391                 {
392                         // Test hide-by-name-and-signature
393                         Assert.AreEqual (1, typeof (Derived2).GetProperties ().Length);
394                         Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetProperties ()[0].DeclaringType);
395                 }
396
397                 [Test] // GetProperties (BindingFlags)
398                 public void GetProperties_Flags ()
399                 {
400                         PropertyInfo [] props;
401                         Type type = typeof (Bar);
402                         BindingFlags flags;
403
404                         flags = BindingFlags.Instance | BindingFlags.NonPublic;
405                         props = type.GetProperties (flags);
406
407                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#A1");
408                         Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#A2");
409                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#A3");
410                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#A4");
411                         Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#A5");
412                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#A6");
413                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#A7");
414                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#A8");
415                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#A9");
416                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#A10");
417                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#A11");
418                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#A12");
419                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#A13");
420                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#A14");
421                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#A15");
422                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#A16");
423                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#A17");
424                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#A18");
425                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#A19");
426                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#A20");
427                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#A21");
428                         Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#A22");
429                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#A23");
430                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#A24");
431                         Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#A25");
432                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#A26");
433                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#A27");
434                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#A28");
435                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#A29");
436                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#A30");
437
438                         flags = BindingFlags.Instance | BindingFlags.Public;
439                         props = type.GetProperties (flags);
440
441                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#B1");
442                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#B2");
443                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#B3");
444                         Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#B4");
445                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#B5");
446                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#B6");
447                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#B7");
448                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#B8");
449                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#B9");
450                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#B10");
451                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#B11");
452                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#B12");
453                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#B13");
454                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#B14");
455                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#B15");
456                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#B16");
457                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#B17");
458                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#B18");
459                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#B19");
460                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#B20");
461                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#B21");
462                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#B22");
463                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#B23");
464                         Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#B24");
465                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#B25");
466                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#B26");
467                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#B27");
468                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#B28");
469                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#B29");
470                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#B30");
471
472                         flags = BindingFlags.Static | BindingFlags.Public;
473                         props = type.GetProperties (flags);
474
475                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#C1");
476                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#C2");
477                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#C3");
478                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#C4");
479                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#C5");
480                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#C6");
481                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#C7");
482                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#C8");
483                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#C9");
484                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#C10");
485                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#C11");
486                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#C12");
487                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#C13");
488                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#C14");
489                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#C15");
490                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#C16");
491                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#C17");
492                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#C18");
493                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#C19");
494                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#C20");
495                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#C21");
496                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#C22");
497                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#C23");
498                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#C24");
499                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#C25");
500                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#C26");
501                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#C27");
502                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#C28");
503                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#C29");
504                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#C30");
505
506                         flags = BindingFlags.Static | BindingFlags.NonPublic;
507                         props = type.GetProperties (flags);
508
509                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#D1");
510                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#D2");
511                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#D3");
512                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#D4");
513                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#D5");
514                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#D6");
515                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#D7");
516                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#D8");
517                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#D9");
518                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#D10");
519                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#D11");
520                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#D12");
521                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#D13");
522                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#D14");
523                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#D15");
524                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#D16");
525                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#D17");
526                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#D18");
527                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#D19");
528                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#D20");
529                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#D21");
530                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#D22");
531                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#D23");
532                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#D24");
533                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#D25");
534                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#D26");
535                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#D27");
536                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#D28");
537                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#D29");
538                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#D30");
539
540                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
541                                 BindingFlags.FlattenHierarchy;
542                         props = type.GetProperties (flags);
543
544                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#E1");
545                         Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#E2");
546                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#E3");
547                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#E4");
548                         Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#E5");
549                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#E6");
550                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#E7");
551                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#E8");
552                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#E9");
553                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#E10");
554                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#E11");
555                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#E12");
556                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#E13");
557                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#E14");
558                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#E15");
559                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#E16");
560                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#E17");
561                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#E18");
562                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#E19");
563                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#E20");
564                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#E21");
565                         Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#E22");
566                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#E23");
567                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#E24");
568                         Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#E25");
569                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#E26");
570                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#E27");
571                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#E28");
572                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#E29");
573                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#E30");
574
575                         flags = BindingFlags.Instance | BindingFlags.Public |
576                                 BindingFlags.FlattenHierarchy;
577                         props = type.GetProperties (flags);
578
579                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#F1");
580                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#F2");
581                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#F3");
582                         Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#F4");
583                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#F5");
584                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#F6");
585                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#F7");
586                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#F8");
587                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#F9");
588                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#F10");
589                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#F11");
590                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#F12");
591                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#F13");
592                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#F14");
593                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#F15");
594                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#F16");
595                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#F17");
596                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#F18");
597                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#F19");
598                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#F20");
599                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#F21");
600                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#F22");
601                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#F23");
602                         Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#F24");
603                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#F25");
604                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#F26");
605                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#F27");
606                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#F28");
607                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#F29");
608                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#F30");
609
610                         flags = BindingFlags.Static | BindingFlags.Public |
611                                 BindingFlags.FlattenHierarchy;
612                         props = type.GetProperties (flags);
613
614                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#G1");
615                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#G2");
616                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#G3");
617                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#G4");
618                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#G5");
619                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#G6");
620                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#G7");
621                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#G8");
622                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#G9");
623                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#G10");
624                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#G11");
625                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#G12");
626                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#G13");
627                         Assert.IsTrue (ContainsProperty (props, "PubStatBase"), "#G14");
628                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#G15");
629                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#G16");
630                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#G17");
631                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#G18");
632                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#G19");
633                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#G20");
634                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#G21");
635                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#G22");
636                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#G23");
637                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#G24");
638                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#G25");
639                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#G26");
640                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#G27");
641                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#G28");
642                         Assert.IsTrue (ContainsProperty (props, "PubStatBlue"), "#G29");
643                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#G30");
644
645                         flags = BindingFlags.Static | BindingFlags.NonPublic |
646                                 BindingFlags.FlattenHierarchy;
647                         props = type.GetProperties (flags);
648
649                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#H1");
650                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#H2");
651                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#H3");
652                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#H4");
653                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#H5");
654                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#H6");
655                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#H7");
656                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#H8");
657                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#H9");
658                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#H10");
659                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#H11");
660                         Assert.IsTrue (ContainsProperty (props, "ProtStatBase"), "#H12");
661                         Assert.IsTrue (ContainsProperty (props, "ProIntStatBase"), "#H13");
662                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#H14");
663                         Assert.IsTrue (ContainsProperty (props, "IntStatBase"), "#H15");
664                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#H16");
665                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#H17");
666                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#H18");
667                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#H19");
668                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#H20");
669                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#H21");
670                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#H22");
671                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#H23");
672                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#H24");
673                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#H25");
674                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#H26");
675                         Assert.IsTrue (ContainsProperty (props, "ProtStatBlue"), "#H27");
676                         Assert.IsTrue (ContainsProperty (props, "ProIntStatBlue"), "#H28");
677                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#H29");
678                         Assert.IsTrue (ContainsProperty (props, "IntStatBlue"), "#H30");
679
680                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
681                                 BindingFlags.DeclaredOnly;
682                         props = type.GetProperties (flags);
683
684                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#I1");
685                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#I2");
686                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#I3");
687                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#I4");
688                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#I5");
689                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#I6");
690                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#I7");
691                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#I8");
692                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#I9");
693                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#I10");
694                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#I11");
695                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#I12");
696                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#I13");
697                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#I14");
698                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#I15");
699                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#I16");
700                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#I17");
701                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#I18");
702                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#I19");
703                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#I20");
704                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#I21");
705                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#I22");
706                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#I23");
707                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#I24");
708                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#I25");
709                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#I26");
710                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#I27");
711                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#I28");
712                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#I29");
713                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#I30");
714
715                         flags = BindingFlags.Instance | BindingFlags.Public |
716                                 BindingFlags.DeclaredOnly;
717                         props = type.GetProperties (flags);
718
719                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#J1");
720                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#J2");
721                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#J3");
722                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#J4");
723                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#J5");
724                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#J6");
725                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#J7");
726                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#J8");
727                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#J9");
728                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#J10");
729                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#J11");
730                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#J12");
731                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#J13");
732                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#J14");
733                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#J15");
734                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#J16");
735                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#J17");
736                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#J18");
737                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#J19");
738                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#J20");
739                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#J21");
740                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#J22");
741                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#J23");
742                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#J24");
743                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#J25");
744                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#J26");
745                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#J27");
746                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#J28");
747                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#J29");
748                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#J30");
749
750                         flags = BindingFlags.Static | BindingFlags.Public |
751                                 BindingFlags.DeclaredOnly;
752                         props = type.GetProperties (flags);
753
754                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#K1");
755                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#K2");
756                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#K3");
757                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#K4");
758                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#K5");
759                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#K6");
760                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#K7");
761                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#K8");
762                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#K9");
763                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#K10");
764                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#K11");
765                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#K12");
766                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#K13");
767                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#K14");
768                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#K15");
769                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#K16");
770                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#K17");
771                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#K18");
772                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#K19");
773                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#K20");
774                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#K21");
775                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#K22");
776                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#K23");
777                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#K24");
778                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#K25");
779                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#K26");
780                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#K27");
781                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#K28");
782                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#K29");
783                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#K30");
784
785                         flags = BindingFlags.Static | BindingFlags.NonPublic |
786                                 BindingFlags.DeclaredOnly;
787                         props = type.GetProperties (flags);
788
789                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#L1");
790                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#L2");
791                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#L3");
792                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#L4");
793                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#L5");
794                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#L6");
795                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#L7");
796                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#L8");
797                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#L9");
798                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#L10");
799                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#L11");
800                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#L12");
801                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#L13");
802                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#L14");
803                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#L15");
804                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#L16");
805                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#L17");
806                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#L18");
807                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#L19");
808                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#L20");
809                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#L21");
810                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#L22");
811                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#L23");
812                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#L24");
813                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#L25");
814                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#L26");
815                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#L27");
816                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#L28");
817                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#L29");
818                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#L30");
819
820                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
821                                 BindingFlags.Public;
822                         props = type.GetProperties (flags);
823
824                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#M1");
825                         Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#M2");
826                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#M3");
827                         Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#M4");
828                         Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#M5");
829                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#M6");
830                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#M7");
831                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#M8");
832                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#M9");
833                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#M10");
834                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#M11");
835                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#M12");
836                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#M13");
837                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#M14");
838                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#M15");
839                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#M16");
840                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#M17");
841                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#M18");
842                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#M19");
843                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#M20");
844                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#M21");
845                         Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#M22");
846                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#M23");
847                         Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#M24");
848                         Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#M25");
849                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#M26");
850                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#M27");
851                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#M28");
852                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#M29");
853                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#M30");
854
855                         flags = BindingFlags.Static | BindingFlags.NonPublic |
856                                 BindingFlags.Public;
857                         props = type.GetProperties (flags);
858
859                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#N1");
860                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#N2");
861                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#N3");
862                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#N4");
863                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#N5");
864                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#N6");
865                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#N7");
866                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#N8");
867                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#N9");
868                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#N10");
869                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#N11");
870                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#N12");
871                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#N13");
872                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#N14");
873                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#N15");
874                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#N16");
875                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#N17");
876                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#N18");
877                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#N19");
878                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#N20");
879                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#N21");
880                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#N22");
881                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#N23");
882                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#N24");
883                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#N25");
884                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#N26");
885                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#N27");
886                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#N28");
887                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#N29");
888                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#N30");
889                 }
890
891                 [Test] // GetProperty (String)
892                 public void GetProperty1_Name_Null ()
893                 {
894                         Type type = typeof (Bar);
895                         try {
896                                 type.GetProperty ((string) null);
897                                 Assert.Fail ("#1");
898                         } catch (ArgumentNullException ex) {
899                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
900                                 Assert.IsNull (ex.InnerException, "#3");
901                                 Assert.IsNotNull (ex.Message, "#4");
902                                 Assert.IsNotNull (ex.ParamName, "#5");
903                                 Assert.AreEqual ("name", ex.ParamName, "#6");
904                         }
905                 }
906
907                 [Test] // GetProperty (String, BindingFlags)
908                 public void GetProperty2 ()
909                 {
910                         Type type = typeof (Bar);
911                         BindingFlags flags;
912
913                         flags = BindingFlags.Instance | BindingFlags.NonPublic;
914
915                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#A1");
916                         Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#A2");
917                         Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#A3");
918                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#A4");
919                         Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#A5");
920                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#A6");
921                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#A7");
922                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#A8");
923                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#A9");
924                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#A10");
925                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#A11");
926                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#A12");
927                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#A13");
928                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#A14");
929                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#A15");
930                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#A16");
931                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#A17");
932                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#A18");
933                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#A19");
934                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#A20");
935                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#A21");
936                         Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#A22");
937                         Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#A23");
938                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#A24");
939                         Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#A25");
940                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#A26");
941                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#A27");
942                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#A28");
943                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#A29");
944                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#A30");
945
946                         flags = BindingFlags.Instance | BindingFlags.Public;
947
948                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#B1");
949                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#B2");
950                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#B3");
951                         Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#B4");
952                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#B5");
953                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#B6");
954                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#B7");
955                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#B8");
956                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#B9");
957                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#B10");
958                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#B11");
959                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#B12");
960                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#B13");
961                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#B14");
962                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#B15");
963                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#B16");
964                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#B17");
965                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#B18");
966                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#B19");
967                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#B20");
968                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#B21");
969                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#B22");
970                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#B23");
971                         Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#B24");
972                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#B25");
973                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#B26");
974                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#B27");
975                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#B28");
976                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#B29");
977                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#B30");
978
979                         flags = BindingFlags.Static | BindingFlags.Public;
980
981                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#C1");
982                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#C2");
983                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#C3");
984                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#C4");
985                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#C5");
986                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#C6");
987                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#C7");
988                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#C8");
989                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#C9");
990                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#C10");
991                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#C11");
992                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#C12");
993                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#C13");
994                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#C14");
995                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#C15");
996                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#C16");
997                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#C17");
998                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#C18");
999                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#C19");
1000                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#C20");
1001                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#C21");
1002                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#C22");
1003                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#C23");
1004                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#C24");
1005                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#C25");
1006                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#C26");
1007                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#C27");
1008                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#C28");
1009                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#C29");
1010                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#C30");
1011
1012                         flags = BindingFlags.Static | BindingFlags.NonPublic;
1013
1014                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#D1");
1015                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#D2");
1016                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#D3");
1017                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#D4");
1018                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#D5");
1019                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#D6");
1020                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#D7");
1021                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#D8");
1022                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#D9");
1023                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#D10");
1024                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#D11");
1025                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#D12");
1026                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#D13");
1027                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#D14");
1028                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#D15");
1029                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#D16");
1030                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#D17");
1031                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#D18");
1032                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#D19");
1033                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#D20");
1034                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#D21");
1035                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#D22");
1036                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#D23");
1037                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#D24");
1038                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#D25");
1039                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#D26");
1040                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#D27");
1041                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#D28");
1042                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#D29");
1043                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#D30");
1044
1045                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
1046                                 BindingFlags.FlattenHierarchy;
1047
1048                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#E1");
1049                         Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#E2");
1050                         Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#E3");
1051                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#E4");
1052                         Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#E5");
1053                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#E6");
1054                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#E7");
1055                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#E8");
1056                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#E9");
1057                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#E10");
1058                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#E11");
1059                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#E12");
1060                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#E13");
1061                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#E14");
1062                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#E15");
1063                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#E16");
1064                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#E17");
1065                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#E18");
1066                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#E19");
1067                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#E20");
1068                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#E21");
1069                         Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#E22");
1070                         Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#E23");
1071                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#E24");
1072                         Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1073                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#E26");
1074                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#E27");
1075                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#E28");
1076                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#E29");
1077                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#E30");
1078
1079                         flags = BindingFlags.Instance | BindingFlags.Public |
1080                                 BindingFlags.FlattenHierarchy;
1081
1082                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#F1");
1083                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#F2");
1084                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#F3");
1085                         Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#F4");
1086                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#F5");
1087                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#F6");
1088                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#F7");
1089                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#F8");
1090                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#F9");
1091                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#F10");
1092                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#F11");
1093                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#F12");
1094                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#F13");
1095                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#F14");
1096                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#F15");
1097                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#F16");
1098                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#F17");
1099                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#F18");
1100                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#F19");
1101                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#F20");
1102                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#F21");
1103                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#F22");
1104                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#F23");
1105                         Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#F24");
1106                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#F25");
1107                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#F26");
1108                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#F27");
1109                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#F28");
1110                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#F29");
1111                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#F30");
1112
1113                         flags = BindingFlags.Static | BindingFlags.Public |
1114                                 BindingFlags.FlattenHierarchy;
1115
1116                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#G1");
1117                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#G2");
1118                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#G3");
1119                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#G4");
1120                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#G5");
1121                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#G6");
1122                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#G7");
1123                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#G8");
1124                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#G9");
1125                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#G10");
1126                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#G11");
1127                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#G12");
1128                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#G13");
1129                         Assert.IsNotNull (type.GetProperty ("PubStatBase", flags), "#G14");
1130                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#G15");
1131                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#G16");
1132                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#G17");
1133                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#G18");
1134                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#G19");
1135                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#G20");
1136                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#G21");
1137                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#G22");
1138                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#G23");
1139                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#G24");
1140                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#G25");
1141                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#G26");
1142                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#G27");
1143                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#G28");
1144                         Assert.IsNotNull (type.GetProperty ("PubStatBlue", flags), "#G29");
1145                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#G30");
1146
1147                         flags = BindingFlags.Static | BindingFlags.NonPublic |
1148                                 BindingFlags.FlattenHierarchy;
1149
1150                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#H1");
1151                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#H2");
1152                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#H3");
1153                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#H4");
1154                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#H5");
1155                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#H6");
1156                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#H7");
1157                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#H8");
1158                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#H9");
1159                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#H10");
1160                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#H11");
1161                         Assert.IsNotNull (type.GetProperty ("ProtStatBase", flags), "#H12");
1162                         Assert.IsNotNull (type.GetProperty ("ProIntStatBase", flags), "#H13");
1163                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#H14");
1164                         Assert.IsNotNull (type.GetProperty ("IntStatBase", flags), "#H15");
1165                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#H16");
1166                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#H17");
1167                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#H18");
1168                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#H19");
1169                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#H20");
1170                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#H21");
1171                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#H22");
1172                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#H23");
1173                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#H24");
1174                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#H25");
1175                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#H26");
1176                         Assert.IsNotNull (type.GetProperty ("ProtStatBlue", flags), "#H27");
1177                         Assert.IsNotNull (type.GetProperty ("ProIntStatBlue", flags), "#H28");
1178                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#H29");
1179                         Assert.IsNotNull (type.GetProperty ("IntStatBlue", flags), "#H30");
1180
1181                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
1182                                 BindingFlags.DeclaredOnly;
1183
1184                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#I1");
1185                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#I2");
1186                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#I3");
1187                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#I4");
1188                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#I5");
1189                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#I6");
1190                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#I7");
1191                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#I8");
1192                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#I9");
1193                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#I10");
1194                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#I11");
1195                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#I12");
1196                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#I13");
1197                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#I14");
1198                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#I15");
1199                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#I16");
1200                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#I17");
1201                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#I18");
1202                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#I19");
1203                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#I20");
1204                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#I21");
1205                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#I22");
1206                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#I23");
1207                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#I24");
1208                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#I25");
1209                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#I26");
1210                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#I27");
1211                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#I28");
1212                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#I29");
1213                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#I30");
1214
1215                         flags = BindingFlags.Instance | BindingFlags.Public |
1216                                 BindingFlags.DeclaredOnly;
1217
1218                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#J1");
1219                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#J2");
1220                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#J3");
1221                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#J4");
1222                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#J5");
1223                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#J6");
1224                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#J7");
1225                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#J8");
1226                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#J9");
1227                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#J10");
1228                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#J11");
1229                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#J12");
1230                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#J13");
1231                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#J14");
1232                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#J15");
1233                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#J16");
1234                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#J17");
1235                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#J18");
1236                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#J19");
1237                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#J20");
1238                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#J21");
1239                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#J22");
1240                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#J23");
1241                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#J24");
1242                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#J25");
1243                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#J26");
1244                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#J27");
1245                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#J28");
1246                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#J29");
1247                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#J30");
1248
1249                         flags = BindingFlags.Static | BindingFlags.Public |
1250                                 BindingFlags.DeclaredOnly;
1251
1252                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#K1");
1253                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#K2");
1254                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#K3");
1255                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#K4");
1256                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#K5");
1257                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#K6");
1258                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#K7");
1259                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#K8");
1260                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#K9");
1261                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#K10");
1262                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#K11");
1263                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#K12");
1264                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#K13");
1265                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#K14");
1266                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#K15");
1267                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#K16");
1268                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#K17");
1269                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#K18");
1270                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#K19");
1271                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#K20");
1272                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#K21");
1273                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#K22");
1274                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#K23");
1275                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#K24");
1276                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#K25");
1277                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#K26");
1278                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#K27");
1279                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#K28");
1280                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#K29");
1281                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#K30");
1282
1283                         flags = BindingFlags.Static | BindingFlags.NonPublic |
1284                                 BindingFlags.DeclaredOnly;
1285
1286                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#L1");
1287                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#L2");
1288                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#L3");
1289                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#L4");
1290                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#L5");
1291                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#L6");
1292                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#L7");
1293                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#L8");
1294                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#L9");
1295                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#L10");
1296                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#L11");
1297                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#L12");
1298                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#L13");
1299                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#L14");
1300                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#L15");
1301                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#L16");
1302                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#L17");
1303                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#L18");
1304                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#L19");
1305                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#L20");
1306                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#L21");
1307                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#L22");
1308                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#L23");
1309                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#L24");
1310                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#L25");
1311                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#L26");
1312                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#L27");
1313                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#L28");
1314                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#L29");
1315                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#L30");
1316
1317                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
1318                                 BindingFlags.Public;
1319
1320                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#M1");
1321                         Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#M2");
1322                         Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#M3");
1323                         Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#M4");
1324                         Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#M5");
1325                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#M6");
1326                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#M7");
1327                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#M8");
1328                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#M9");
1329                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#M10");
1330                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#M11");
1331                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#M12");
1332                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#M13");
1333                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#M14");
1334                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#M15");
1335                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#M16");
1336                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#M17");
1337                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#M18");
1338                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#M19");
1339                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#M20");
1340                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#M21");
1341                         Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#M22");
1342                         Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#M23");
1343                         Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#M24");
1344                         Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1345                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#M26");
1346                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#M27");
1347                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#M28");
1348                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#M29");
1349                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#M30");
1350
1351                         flags = BindingFlags.Static | BindingFlags.NonPublic |
1352                                 BindingFlags.Public;
1353
1354                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#N1");
1355                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#N2");
1356                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#N3");
1357                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#N4");
1358                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#N5");
1359                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#N6");
1360                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#N7");
1361                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#N8");
1362                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#N9");
1363                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#N10");
1364                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#N11");
1365                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#N12");
1366                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#N13");
1367                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#N14");
1368                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#N15");
1369                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#N16");
1370                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#N17");
1371                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#N18");
1372                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#N19");
1373                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#N20");
1374                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#N21");
1375                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#N22");
1376                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#N23");
1377                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#N24");
1378                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#N25");
1379                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#N26");
1380                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#N27");
1381                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#N28");
1382                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#N29");
1383                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#N30");
1384                 }
1385
1386                 [Test] // GetProperty (String, BindingFlags)
1387                 public void GetProperty2_Name_Null ()
1388                 {
1389                         Type type = typeof (Bar);
1390                         try {
1391                                 type.GetProperty ((string) null);
1392                                 Assert.Fail ("#1");
1393                         } catch (ArgumentNullException ex) {
1394                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1395                                 Assert.IsNull (ex.InnerException, "#3");
1396                                 Assert.IsNotNull (ex.Message, "#4");
1397                                 Assert.IsNotNull (ex.ParamName, "#5");
1398                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1399                         }
1400                 }
1401
1402                 [Test] // GetProperty (String, Type)
1403                 public void GetProperty3_Name_Null ()
1404                 {
1405                         Type type = typeof (Bar);
1406                         try {
1407                                 type.GetProperty ((string) null, typeof (int));
1408                                 Assert.Fail ("#1");
1409                         } catch (ArgumentNullException ex) {
1410                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1411                                 Assert.IsNull (ex.InnerException, "#3");
1412                                 Assert.IsNotNull (ex.Message, "#4");
1413                                 Assert.IsNotNull (ex.ParamName, "#5");
1414                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1415                         }
1416                 }
1417
1418                 [Test] // GetProperty (String, Type [])
1419                 public void GetProperty4_Name_Null ()
1420                 {
1421                         Type type = typeof (Bar);
1422                         try {
1423                                 type.GetProperty ((string) null, Type.EmptyTypes);
1424                                 Assert.Fail ("#1");
1425                         } catch (ArgumentNullException ex) {
1426                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1427                                 Assert.IsNull (ex.InnerException, "#3");
1428                                 Assert.IsNotNull (ex.Message, "#4");
1429                                 Assert.IsNotNull (ex.ParamName, "#5");
1430                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1431                         }
1432                 }
1433
1434                 [Test] // GetProperty (String, Type, Type [])
1435                 public void GetProperty5_Name_Null ()
1436                 {
1437                         Type type = typeof (Bar);
1438                         try {
1439                                 type.GetProperty ((string) null, typeof (int),
1440                                         Type.EmptyTypes);
1441                                 Assert.Fail ("#1");
1442                         } catch (ArgumentNullException ex) {
1443                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1444                                 Assert.IsNull (ex.InnerException, "#3");
1445                                 Assert.IsNotNull (ex.Message, "#4");
1446                                 Assert.IsNotNull (ex.ParamName, "#5");
1447                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1448                         }
1449                 }
1450
1451                 [Test] // GetProperty (String, Type, Type [], ParameterModifier [])
1452                 public void GetProperty6_Name_Null ()
1453                 {
1454                         Type type = typeof (Bar);
1455                         try {
1456                                 type.GetProperty ((string) null, typeof (int),
1457                                         Type.EmptyTypes, null);
1458                                 Assert.Fail ("#1");
1459                         } catch (ArgumentNullException ex) {
1460                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1461                                 Assert.IsNull (ex.InnerException, "#3");
1462                                 Assert.IsNotNull (ex.Message, "#4");
1463                                 Assert.IsNotNull (ex.ParamName, "#5");
1464                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1465                         }
1466                 }
1467
1468                 [Test] // GetProperty (String, BindingFlags, Binder, Type, Type [], ParameterModifier [])
1469                 public void GetProperty7_Name_Null ()
1470                 {
1471                         Type type = typeof (Bar);
1472                         try {
1473                                 type.GetProperty ((string) null, BindingFlags.Public,
1474                                         null, typeof (int), Type.EmptyTypes, null);
1475                                 Assert.Fail ("#1");
1476                         } catch (ArgumentNullException ex) {
1477                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1478                                 Assert.IsNull (ex.InnerException, "#3");
1479                                 Assert.IsNotNull (ex.Message, "#4");
1480                                 Assert.IsNotNull (ex.ParamName, "#5");
1481                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1482                         }
1483                 }
1484
1485                 [Test]
1486                 public void GetProperty8_PropertyType ()
1487                 {
1488                         Type type = typeof (Bar);
1489                         Assert.IsNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance,
1490                                                          null, typeof (int), Type.EmptyTypes, null), "#1");
1491                         Assert.IsNotNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance, null, 
1492                                                             typeof (long), new Type[0], null), "#2");
1493                 }
1494
1495 #if !TARGET_JVM // StructLayout not supported for TARGET_JVM
1496                 [StructLayout(LayoutKind.Explicit, Pack = 4, Size = 64)]
1497                 public class Class1
1498                 {
1499                 }
1500
1501                 [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
1502                 public class Class2
1503                 {
1504                 }
1505
1506                 [Test]
1507                 public void StructLayoutAttribute ()
1508                 {
1509                         StructLayoutAttribute attr1 = typeof (TypeTest).StructLayoutAttribute;
1510                         Assert.AreEqual (LayoutKind.Auto, attr1.Value);
1511
1512                         StructLayoutAttribute attr2 = typeof (Class1).StructLayoutAttribute;
1513                         Assert.AreEqual (LayoutKind.Explicit, attr2.Value);
1514                         Assert.AreEqual (4, attr2.Pack);
1515                         Assert.AreEqual (64, attr2.Size);
1516
1517                         StructLayoutAttribute attr3 = typeof (Class2).StructLayoutAttribute;
1518                         Assert.AreEqual (LayoutKind.Explicit, attr3.Value);
1519                         Assert.AreEqual (CharSet.Unicode, attr3.CharSet);
1520                 }
1521 #endif // TARGET_JVM
1522
1523                 [Test]
1524                 public void Namespace ()
1525                 {
1526                         Assert.AreEqual (null, typeof (NoNamespaceClass).Namespace);
1527                 }
1528
1529                 [Test]
1530                 public void GenericParameterNamespace ()
1531                 {
1532                         var t = typeof (Foo<>).GetGenericArguments () [0];
1533
1534                         Assert.AreEqual ("T", t.Name);
1535                         Assert.AreEqual ("MonoTests.System", t.Namespace);
1536
1537                         var s = typeof (Gazonk).GetMethod ("Bang").GetGenericArguments () [0];
1538
1539                         Assert.AreEqual ("S", s.Name);
1540                         Assert.AreEqual ("MonoTests.System", s.Namespace);
1541                 }
1542
1543                 public static void Reflected (ref int a)
1544                 {
1545                 }
1546
1547                 [Test]
1548                 public void Name ()
1549                 {
1550                         Assert.AreEqual ("Int32&", typeof (TypeTest).GetMethod ("Reflected").GetParameters () [0].ParameterType.Name);
1551                         Assert.AreEqual ("String[*]", Array.CreateInstance (typeof(string), new int[] { 1 }, new int[] { 1 }).GetType ().Name);
1552                 }
1553
1554                 [Test]
1555                 public void GetInterfaces ()
1556                 {
1557                         Type[] t = typeof (Duper).GetInterfaces ();
1558                         Assert.AreEqual (1, t.Length);
1559                         Assert.AreEqual (typeof (ICloneable), t[0]);
1560
1561                         Type[] t2 = typeof (IFace3).GetInterfaces ();
1562                         Assert.AreEqual (2, t2.Length);
1563                 }
1564
1565                 public int AField;
1566
1567                 [Test]
1568                 public void GetFieldIgnoreCase ()
1569                 {
1570                         Assert.IsNotNull (typeof (TypeTest).GetField ("afield", BindingFlags.Instance|BindingFlags.Public|BindingFlags.IgnoreCase));
1571                 }
1572
1573                 public int Count {
1574                         internal get {
1575                                 return 0;
1576                         }
1577
1578                         set {
1579                         }
1580                 }
1581
1582                 [Test]
1583                 public void GetPropertyAccessorModifiers ()
1584                 {
1585                         Assert.IsNotNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.Public));
1586                         Assert.IsNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.NonPublic));
1587                 }
1588
1589                 [Test]
1590                 public void IsAbstract ()
1591                 {
1592                         Assert.IsFalse (typeof (string).IsAbstract, "#1");
1593                         Assert.IsTrue (typeof (ICloneable).IsAbstract, "#2");
1594                         Assert.IsTrue (typeof (ValueType).IsAbstract, "#3");
1595                         Assert.IsTrue (typeof (Enum).IsAbstract, "#4");
1596                         Assert.IsFalse (typeof (TimeSpan).IsAbstract, "#5");
1597                         Assert.IsTrue (typeof (TextReader).IsAbstract, "#6");
1598
1599                         // LAMESPEC:
1600                         // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=286308
1601                         Type [] typeArgs = typeof (List<>).GetGenericArguments ();
1602                         Assert.IsFalse (typeArgs [0].IsAbstract, "#7");
1603                 }
1604
1605                 [Test]
1606                 public void IsCOMObject ()
1607                 {
1608                         Type type = typeof (string);
1609                         Assert.IsFalse (type.IsCOMObject, "#1");
1610
1611                         TypeBuilder tb = module.DefineType (genTypeName ());
1612                         type = tb.CreateType ();
1613                         Assert.IsFalse (type.IsCOMObject, "#2");
1614                 }
1615
1616                 [Test]
1617                 public void IsImport ()
1618                 {
1619                         Type type = typeof (string);
1620                         Assert.IsFalse (type.IsImport, "#1");
1621
1622                         TypeBuilder tb = module.DefineType (genTypeName ());
1623                         type = tb.CreateType ();
1624                         Assert.IsFalse (type.IsImport, "#2");
1625
1626                         tb = module.DefineType (genTypeName (), TypeAttributes.Import |
1627                                 TypeAttributes.Interface | TypeAttributes.Abstract);
1628                         type = tb.CreateType ();
1629                         Assert.IsTrue (type.IsImport, "#3");
1630                 }
1631
1632                 [Test]
1633                 public void IsInterface ()
1634                 {
1635                         Assert.IsFalse (typeof (string).IsInterface, "#1");
1636                         Assert.IsTrue (typeof (ICloneable).IsInterface, "#2");
1637                 }
1638
1639                 [Test]
1640                 public void IsPrimitive () {
1641                         Assert.IsTrue (typeof (IntPtr).IsPrimitive, "#1");
1642                         Assert.IsTrue (typeof (int).IsPrimitive, "#2");
1643                         Assert.IsFalse (typeof (string).IsPrimitive, "#2");
1644                 }
1645
1646                 [Test]
1647                 public void IsValueType ()
1648                 {
1649                         Assert.IsTrue (typeof (int).IsValueType, "#1");
1650                         Assert.IsFalse (typeof (Enum).IsValueType, "#2");
1651                         Assert.IsFalse (typeof (ValueType).IsValueType, "#3");
1652                         Assert.IsTrue (typeof (AttributeTargets).IsValueType, "#4");
1653                         Assert.IsFalse (typeof (string).IsValueType, "#5");
1654                         Assert.IsTrue (typeof (TimeSpan).IsValueType, "#6");
1655                 }
1656
1657                 [Test]
1658                 [Category("NotDotNet")]
1659                 // Depends on the GAC working, which it doesn't durring make distcheck.
1660                 [Category ("NotWorking")]
1661                 public void GetTypeWithWhitespace ()
1662                 {
1663                         Assert.IsNotNull (Type.GetType
1664                                                    (@"System.Configuration.NameValueSectionHandler,
1665                         System,
1666 Version=1.0.5000.0,
1667 Culture=neutral
1668 ,
1669 PublicKeyToken=b77a5c561934e089"));
1670                 }
1671
1672                 [Test]
1673                 public void GetTypeNonVectorArray ()
1674                 {
1675                         Type t = Type.GetType ("System.String[*]");
1676                         Assert.AreEqual ("System.String[*]", t.ToString ());
1677                 }
1678                 
1679                 [Test]
1680                 public void ExerciseFilterName ()
1681                 {
1682                         MemberInfo[] mi = typeof(Base).FindMembers(
1683                                 MemberTypes.Method, 
1684                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1685                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1686                                 Type.FilterName, "*");
1687                         Assert.AreEqual (4, mi.Length);
1688                         mi = typeof(Base).FindMembers(
1689                                 MemberTypes.Method, 
1690                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1691                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1692                                 Type.FilterName, "Test*");
1693                         Assert.AreEqual (2, mi.Length);
1694                         mi = typeof(Base).FindMembers(
1695                                 MemberTypes.Method, 
1696                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1697                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1698                                 Type.FilterName, "TestVoid");
1699                         Assert.AreEqual (1, mi.Length);
1700                         mi = typeof(Base).FindMembers(
1701                                 MemberTypes.Method, 
1702                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1703                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1704                                 Type.FilterName, "NonExistingMethod");
1705                         Assert.AreEqual (0, mi.Length);
1706                 }
1707                 
1708                 [Test]
1709                 public void ExerciseFilterNameIgnoreCase ()
1710                 {
1711                         MemberInfo[] mi = typeof(Base).FindMembers(
1712                                 MemberTypes.Method, 
1713                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1714                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1715                                 Type.FilterNameIgnoreCase, "*");
1716                         Assert.AreEqual (4, mi.Length);
1717                         mi = typeof(Base).FindMembers(
1718                                 MemberTypes.Method, 
1719                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1720                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1721                                 Type.FilterNameIgnoreCase, "test*");
1722                         Assert.AreEqual (2, mi.Length);
1723                         mi = typeof(Base).FindMembers(
1724                                 MemberTypes.Method, 
1725                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1726                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1727                                 Type.FilterNameIgnoreCase, "TESTVOID");
1728                         Assert.AreEqual (1, mi.Length);
1729                         mi = typeof(Base).FindMembers(
1730                                 MemberTypes.Method, 
1731                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1732                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1733                                 Type.FilterNameIgnoreCase, "NonExistingMethod");
1734                         Assert.AreEqual (0, mi.Length);
1735                 }
1736
1737                 [Test]
1738                 public void GenericParameterMemberType ()
1739                 {
1740                         var t = typeof (Foo<>).GetGenericArguments () [0];
1741                         Assert.IsNotNull (t);
1742
1743                         Assert.AreEqual (MemberTypes.TypeInfo, t.MemberType);
1744                 }
1745
1746                 public class ByRef0
1747                 {
1748                         public int field;
1749                         public int property {
1750                                 get { return 0; }
1751                         }
1752                         public ByRef0 (int i) {}
1753                         public void f (int i) {}
1754                 }
1755
1756                 [Test]
1757                 public void ByrefTypes ()
1758                 {
1759                         Type t = Type.GetType ("MonoTests.System.TypeTest+ByRef0&");
1760                         Assert.IsNotNull (t);
1761                         Assert.IsTrue (t.IsByRef);
1762                         Assert.AreEqual (0, t.GetMethods (BindingFlags.Public | BindingFlags.Instance).Length);
1763                         Assert.AreEqual (0, t.GetConstructors (BindingFlags.Public | BindingFlags.Instance).Length);
1764                         Assert.AreEqual (0, t.GetEvents (BindingFlags.Public | BindingFlags.Instance).Length);
1765                         Assert.AreEqual (0, t.GetProperties (BindingFlags.Public | BindingFlags.Instance).Length);
1766
1767                         Assert.IsNull (t.GetMethod ("f"));
1768                         Assert.IsNull (t.GetField ("field"));
1769                         Assert.IsNull (t.GetProperty ("property"));
1770                 }
1771                 
1772                 [Test]
1773                 public void TestAssemblyQualifiedName ()
1774                 {
1775                         Type t = Type.GetType ("System.Byte[]&");
1776                         Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte[]&"));
1777                         
1778                         t = Type.GetType ("System.Byte*&");
1779                         Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte*&"));
1780                         
1781                         t = Type.GetType ("System.Byte&");
1782                         Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte&"));
1783                 }
1784
1785                 struct B
1786                 {
1787                         int value;
1788                 }
1789
1790                 [Test]
1791                 public void CreateValueTypeNoCtor ()
1792                 {
1793                         typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, null);
1794                 }
1795
1796                 [Test]
1797                 [ExpectedException (typeof (MissingMethodException))]
1798                 public void CreateValueTypeNoCtorArgs ()
1799                 {
1800                         typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, new object [] { 1 });
1801                 }
1802
1803                 internal static string bug336841 (string param1, params string [] param2)
1804                 {
1805                         StringBuilder sb = new StringBuilder ();
1806                         sb.Append ("#A:");
1807                         sb.Append (param1);
1808                         sb.Append ("|");
1809                         for (int i = 0; i < param2.Length; i++) {
1810                                 if (i > 0)
1811                                         sb.Append (",");
1812                                 sb.Append (param2 [i]);
1813                         }
1814                         return sb.ToString ();
1815                 }
1816
1817                 internal static string bug336841 (string param1)
1818                 {
1819                         return "#B:" + param1;
1820                 }
1821
1822                 internal static string bug336841 (params string [] param1)
1823                 {
1824                         StringBuilder sb = new StringBuilder ();
1825                         sb.Append ("#C:");
1826                         for (int i = 0; i < param1.Length; i++) {
1827                                 if (i > 0)
1828                                         sb.Append (";");
1829                                 sb.Append (param1 [i]);
1830                         }
1831                         return sb.ToString ();
1832                 }
1833
1834                 [Test]
1835                 public void InvokeMember_GetSetField ()
1836                 {
1837                         typeof (X).InvokeMember ("Value", BindingFlags.Public |
1838                                 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1839                                 BindingFlags.SetField, null, null, new object [] { 5 });
1840
1841                         Assert.AreEqual (5, X.Value, "#A1");
1842                         Assert.AreEqual (5, typeof (X).InvokeMember ("Value",
1843                                 BindingFlags.Public | BindingFlags.Static |
1844                                 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1845                                 null, null, new object [0]), "#A2");
1846                         Assert.AreEqual (5, Y.Value, "#A3");
1847                         Assert.AreEqual (5, typeof (Y).InvokeMember ("Value",
1848                                 BindingFlags.Public | BindingFlags.Static |
1849                                 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1850                                 null, null, new object [0]), "#A4");
1851
1852                         try {
1853                                 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1854                                         BindingFlags.Static | BindingFlags.FlattenHierarchy |
1855                                         BindingFlags.GetField | BindingFlags.SetField,
1856                                         null, null, new object [] { 5 });
1857                                 Assert.Fail ("#B1");
1858                         } catch (ArgumentException ex) {
1859                                 // Cannot specify both Get and Set on a field
1860                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1861                                 Assert.IsNull (ex.InnerException, "#B3");
1862                                 Assert.IsNotNull (ex.Message, "#B4");
1863                                 Assert.IsNotNull (ex.ParamName, "#B5");
1864                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1865                         }
1866                 }
1867
1868                 [Test]
1869                 public void InvokeMember_GetSetProperty ()
1870                 {
1871                         try {
1872                                 typeof (ArrayList).InvokeMember ("Item",
1873                                         BindingFlags.GetProperty | BindingFlags.SetProperty |
1874                                         BindingFlags.Instance | BindingFlags.Public,
1875                                         null, new ArrayList (), new object [] { 0, "bar" });
1876                                 Assert.Fail ("#1");
1877                         } catch (ArgumentException ex) {
1878                                 // Cannot specify both Get and Set on a property
1879                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1880                                 Assert.IsNull (ex.InnerException, "#3");
1881                                 Assert.IsNotNull (ex.Message, "#4");
1882                                 Assert.IsNotNull (ex.ParamName, "#5");
1883                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1884                         }
1885                 }
1886
1887
1888                 [Test]
1889                 public void InvokeMember_InvokeMethod_Set ()
1890                 {
1891                         try {
1892                                 typeof (ArrayList).InvokeMember ("ToString",
1893                                         BindingFlags.InvokeMethod | BindingFlags.SetField |
1894                                         BindingFlags.Instance | BindingFlags.Public,
1895                                         null, new ArrayList (), new object [0]);
1896                                 Assert.Fail ("#A1");
1897                         } catch (ArgumentException ex) {
1898                                 // Cannot specify Set on a field and Invoke on a method
1899                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1900                                 Assert.IsNull (ex.InnerException, "#A3");
1901                                 Assert.IsNotNull (ex.Message, "#A4");
1902                                 Assert.IsNotNull (ex.ParamName, "#A5");
1903                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#A6");
1904                         }
1905
1906                         try {
1907                                 typeof (ArrayList).InvokeMember ("ToString",
1908                                         BindingFlags.InvokeMethod | BindingFlags.SetProperty |
1909                                         BindingFlags.Instance | BindingFlags.Public,
1910                                         null, new ArrayList (), new object [0]);
1911                                 Assert.Fail ("#B1");
1912                         } catch (ArgumentException ex) {
1913                                 // Cannot specify Set on a property and Invoke on a method
1914                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1915                                 Assert.IsNull (ex.InnerException, "#B3");
1916                                 Assert.IsNotNull (ex.Message, "#B4");
1917                                 Assert.IsNotNull (ex.ParamName, "#B5");
1918                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1919                         }
1920                 }
1921
1922                 [Test]
1923                 public void InvokeMember_MatchPrimitiveTypeWithInterface ()
1924                 {
1925                         object [] invokeargs = { 1 };
1926                         typeof (Z).InvokeMember ("", BindingFlags.DeclaredOnly |
1927                                 BindingFlags.Public | BindingFlags.NonPublic |
1928                                 BindingFlags.Instance | BindingFlags.CreateInstance,
1929                                 null, null, invokeargs);
1930                 }
1931
1932                 [Test]
1933                 public void InvokeMember_Name_Null ()
1934                 {
1935                         try {
1936                                 typeof (X).InvokeMember ((string) null,
1937                                         BindingFlags.Public | BindingFlags.Static |
1938                                         BindingFlags.FlattenHierarchy | BindingFlags.SetField,
1939                                         null, null, new object [] { 5 });
1940                                 Assert.Fail ("#1");
1941                         } catch (ArgumentNullException ex) {
1942                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1943                                 Assert.IsNull (ex.InnerException, "#3");
1944                                 Assert.IsNotNull (ex.Message, "#4");
1945                                 Assert.IsNotNull (ex.ParamName, "#5");
1946                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1947                         }
1948                 }
1949
1950                 [Test]
1951                 public void InvokeMember_NoOperation ()
1952                 {
1953                         try {
1954                                 typeof (TypeTest).InvokeMember ("Run", BindingFlags.Public |
1955                                         BindingFlags.Static, null, null, new object [0]);
1956                                 Assert.Fail ("#1");
1957                         } catch (ArgumentException ex) {
1958                                 // Must specify binding flags describing the
1959                                 // invoke operation required
1960                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1961                                 Assert.IsNull (ex.InnerException, "#3");
1962                                 Assert.IsNotNull (ex.Message, "#4");
1963                                 Assert.IsNotNull (ex.ParamName, "#5");
1964                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1965                         }
1966                 }
1967
1968                 [Test] // bug #321735
1969                 public void InvokeMember_SetFieldProperty ()
1970                 {
1971                         ArrayList list = new ArrayList ();
1972                         list.Add ("foo");
1973                         list.GetType ().InvokeMember ("Item",
1974                                 BindingFlags.SetField | BindingFlags.SetProperty |
1975                                 BindingFlags.Instance | BindingFlags.Public,
1976                                 null, list, new object [] { 0, "bar" });
1977                         Assert.AreEqual ("bar", list [0]);
1978                 }
1979
1980                 [Test]
1981                 public void InvokeMember_SetField_ProvidedArgs ()
1982                 {
1983                         try {
1984                                 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1985                                         BindingFlags.Static | BindingFlags.SetField,
1986                                         null, null, new object [0]);
1987                                 Assert.Fail ("#A1");
1988                         } catch (ArgumentException ex) {
1989                                 // Only the field value can be specified to set
1990                                 // a field value
1991                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1992                                 Assert.IsNull (ex.InnerException, "#A3");
1993                                 Assert.IsNotNull (ex.Message, "#A4");
1994                                 Assert.IsNotNull (ex.ParamName, "#A5");
1995                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1996                         }
1997
1998                         try {
1999                                 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2000                                         BindingFlags.Static | BindingFlags.SetField,
2001                                         null, null, null);
2002                                 Assert.Fail ("#B1");
2003                         } catch (ArgumentNullException ex) {
2004                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2005                                 Assert.IsNull (ex.InnerException, "#B3");
2006                                 Assert.IsNotNull (ex.Message, "#B4");
2007                                 Assert.IsNotNull (ex.ParamName, "#B5");
2008                                 Assert.AreEqual ("providedArgs", ex.ParamName, "#B6");
2009                         }
2010                 }
2011
2012                 [Test] // bug #336841
2013                 [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306797
2014                 public void InvokeMember_VarArgs ()
2015                 {
2016                         BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.Public |
2017                                 BindingFlags.NonPublic | BindingFlags.OptionalParamBinding |
2018                                 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2019                                 BindingFlags.Instance;
2020
2021                         Type type = typeof (TypeTest);
2022                         string result = (string) type.InvokeMember ("bug336841",
2023                                 flags, null, null, new object [] { "1" });
2024                         Assert.IsNotNull (result, "#A1");
2025                         Assert.AreEqual ("#B:1", result, "#A2");
2026
2027                         result = (string) type.InvokeMember ("bug336841", flags,
2028                                 null, null, new object [] { "1", "2", "3", "4" });
2029                         Assert.IsNotNull (result, "#B1");
2030                         Assert.AreEqual ("#A:1|2,3,4", result, "#B2");
2031                 }
2032
2033         
2034                 [Test] // bug #348522
2035                 public void InvokeMember_WithoutDefaultValue ()
2036                 {
2037                         BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;
2038                         try {
2039                                 typeof (Bug348522).InvokeMember ("Test", flags, new FirstMethodBinder (), new Bug348522(),
2040                                         new object [] {Missing.Value}, null, null, null);
2041                                 Assert.Fail ("#1");
2042                         } catch (ArgumentException ex) {
2043                                 // Missing parameter does not have a default value
2044                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2045                                 Assert.IsNull (ex.InnerException, "#3");
2046                                 Assert.IsNotNull (ex.Message, "#4");
2047                                 Assert.IsNotNull (ex.ParamName, "#5");
2048                                 Assert.AreEqual ("parameters", ex.ParamName, "#6");
2049                         }
2050                 }
2051
2052             [Test]
2053                 public void TestMissing () {
2054                         Assert.AreEqual (Type.Missing, Missing.Value);
2055                 }
2056
2057                 [Test]
2058                 public void GetGenericMethodDefinitionOverInflatedMethodOnGTD () {
2059                         var l = typeof (List<>);
2060                         var m = l.GetMethod ("ConvertAll");
2061                         var infl = m.MakeGenericMethod (typeof (int));
2062                         var res = m.GetGenericMethodDefinition ();
2063                         Assert.AreEqual (m, res, "#1");
2064                 }
2065
2066                 [Test]
2067                 public void InvokeMember_OutParam ()
2068                 {
2069                         object[] args = new object[] { new string [0] };
2070                         typeof (TypeTest).InvokeMember ("OutTest", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, args);
2071                         Assert.IsTrue (args [0] is string[]);
2072                         Assert.AreEqual (10, ((string[])args[0]).Length);
2073                 }
2074
2075                 public static void OutTest (out string[] a1)
2076                 {
2077                         a1 = new string [10];
2078                 }
2079
2080                 class X
2081                 {
2082                         public static int Value;
2083                 }
2084
2085                 class Y : X
2086                 {
2087                 }
2088
2089                 class Z
2090                 {
2091                         public Z (IComparable value)
2092                         {
2093                         }
2094                 }
2095         
2096                 public static void Run ()
2097                 {
2098                 }
2099
2100                 class TakesInt
2101                 {
2102                         private int i;
2103
2104                         public TakesInt (int x)
2105                         {
2106                                 i = x;
2107                         }
2108
2109                         public int Integer {
2110                                 get { return i; }
2111                         }
2112                 }
2113
2114                 class TakesObject
2115                 {
2116                         public TakesObject (object x) {}
2117                 }
2118
2119                 [Test] // bug #75241
2120                 public void GetConstructorNullInTypes ()
2121                 {
2122                         // This ends up calling type.GetConstructor ()
2123                         Activator.CreateInstance (typeof (TakesInt), new object [] { null });
2124                         Activator.CreateInstance (typeof (TakesObject), new object [] { null });
2125                 }
2126
2127                 [Test]
2128                 public void GetConstructor_TakeInt_Object ()
2129                 {
2130                         Assert.IsNull (typeof (TakesInt).GetConstructor (new Type[1] { typeof (object) }));
2131                 }
2132
2133                 [Test]
2134                 public void GetCustomAttributes_All ()
2135                 {
2136                         object [] attrs = typeof (A).GetCustomAttributes (false);
2137                         Assert.AreEqual (2, attrs.Length, "#A1");
2138                         Assert.IsTrue (HasAttribute (attrs, typeof (FooAttribute)), "#A2");
2139                         Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#A3");
2140
2141                         attrs = typeof (BA).GetCustomAttributes (false);
2142                         Assert.AreEqual (1, attrs.Length, "#B1");
2143                         Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#B2");
2144
2145                         attrs = typeof (BA).GetCustomAttributes (true);
2146                         Assert.AreEqual (2, attrs.Length, "#C1");
2147                         Assert.IsTrue (HasAttribute (attrs, typeof (BarAttribute)), "#C2");
2148                         Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#C3");
2149
2150                         attrs = typeof (CA).GetCustomAttributes (false);
2151                         Assert.AreEqual (0, attrs.Length, "#D");
2152
2153                         attrs = typeof (CA).GetCustomAttributes (true);
2154                         Assert.AreEqual (1, attrs.Length, "#E1");
2155                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E2");
2156                 }
2157
2158                 static bool HasAttribute (object [] attrs, Type attributeType)
2159                 {
2160                         foreach (object attr in attrs)
2161                                 if (attr.GetType () == attributeType)
2162                                         return true;
2163                         return false;
2164                 }
2165
2166                 [Test]
2167                 public void GetCustomAttributes_Type ()
2168                 {
2169                         object [] attrs = null;
2170
2171                         attrs = typeof (A).GetCustomAttributes (
2172                                 typeof (VolatileModifier), false);
2173                         Assert.AreEqual (1, attrs.Length, "#A1");
2174                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A2");
2175                         attrs = typeof (A).GetCustomAttributes (
2176                                 typeof (VolatileModifier), true);
2177                         Assert.AreEqual (1, attrs.Length, "#A3");
2178                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A4");
2179
2180                         attrs = typeof (A).GetCustomAttributes (
2181                                 typeof (NemerleAttribute), false);
2182                         Assert.AreEqual (1, attrs.Length, "#B1");
2183                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B2");
2184                         attrs = typeof (A).GetCustomAttributes (
2185                                 typeof (NemerleAttribute), true);
2186                         Assert.AreEqual (1, attrs.Length, "#B3");
2187                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B4");
2188
2189                         attrs = typeof (A).GetCustomAttributes (
2190                                 typeof (FooAttribute), false);
2191                         Assert.AreEqual (1, attrs.Length, "#C1");
2192                         Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C2");
2193                         attrs = typeof (A).GetCustomAttributes (
2194                                 typeof (FooAttribute), false);
2195                         Assert.AreEqual (1, attrs.Length, "#C3");
2196                         Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C4");
2197
2198                         attrs = typeof (BA).GetCustomAttributes (
2199                                 typeof (VolatileModifier), false);
2200                         Assert.AreEqual (0, attrs.Length, "#D1");
2201                         attrs = typeof (BA).GetCustomAttributes (
2202                                 typeof (VolatileModifier), true);
2203                         Assert.AreEqual (1, attrs.Length, "#D2");
2204                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#D3");
2205
2206                         attrs = typeof (BA).GetCustomAttributes (
2207                                 typeof (NemerleAttribute), false);
2208                         Assert.AreEqual (0, attrs.Length, "#E1");
2209                         attrs = typeof (BA).GetCustomAttributes (
2210                                 typeof (NemerleAttribute), true);
2211                         Assert.AreEqual (1, attrs.Length, "#E2");
2212                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E3");
2213
2214                         attrs = typeof (BA).GetCustomAttributes (
2215                                 typeof (FooAttribute), false);
2216                         Assert.AreEqual (1, attrs.Length, "#F1");
2217                         Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F2");
2218                         attrs = typeof (BA).GetCustomAttributes (
2219                                 typeof (FooAttribute), true);
2220                         Assert.AreEqual (1, attrs.Length, "#F3");
2221                         Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F4");
2222
2223                         attrs = typeof (bug82431A1).GetCustomAttributes (
2224                                 typeof (InheritAttribute), false);
2225                         Assert.AreEqual (1, attrs.Length, "#G1");
2226                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G2");
2227                         attrs = typeof (bug82431A1).GetCustomAttributes (
2228                                 typeof (InheritAttribute), true);
2229                         Assert.AreEqual (1, attrs.Length, "#G3");
2230                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G4");
2231
2232                         attrs = typeof (bug82431A1).GetCustomAttributes (
2233                                 typeof (NotInheritAttribute), false);
2234                         Assert.AreEqual (1, attrs.Length, "#H1");
2235                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H2");
2236                         attrs = typeof (bug82431A1).GetCustomAttributes (
2237                                 typeof (InheritAttribute), true);
2238                         Assert.AreEqual (1, attrs.Length, "#H3");
2239                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H4");
2240
2241                         attrs = typeof (bug82431A2).GetCustomAttributes (
2242                                 typeof (InheritAttribute), false);
2243                         Assert.AreEqual (0, attrs.Length, "#I1");
2244                         attrs = typeof (bug82431A2).GetCustomAttributes (
2245                                 typeof (InheritAttribute), true);
2246                         Assert.AreEqual (0, attrs.Length, "#I2");
2247
2248                         attrs = typeof (bug82431A2).GetCustomAttributes (
2249                                 typeof (NotInheritAttribute), false);
2250                         Assert.AreEqual (0, attrs.Length, "#J1");
2251                         attrs = typeof (bug82431A2).GetCustomAttributes (
2252                                 typeof (NotInheritAttribute), true);
2253                         Assert.AreEqual (0, attrs.Length, "#J2");
2254
2255                         attrs = typeof (bug82431A3).GetCustomAttributes (
2256                                 typeof (InheritAttribute), false);
2257                         Assert.AreEqual (2, attrs.Length, "#K1");
2258                         Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K2");
2259                         Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K3");
2260                         attrs = typeof (bug82431A3).GetCustomAttributes (
2261                                 typeof (InheritAttribute), true);
2262                         Assert.AreEqual (2, attrs.Length, "#K4");
2263                         Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K5");
2264                         Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K6");
2265
2266                         attrs = typeof (bug82431A3).GetCustomAttributes (
2267                                 typeof (NotInheritAttribute), false);
2268                         Assert.AreEqual (1, attrs.Length, "#L1");
2269                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L2");
2270                         attrs = typeof (bug82431A3).GetCustomAttributes (
2271                                 typeof (NotInheritAttribute), true);
2272                         Assert.AreEqual (1, attrs.Length, "#L3");
2273                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L4");
2274
2275                         attrs = typeof (bug82431B1).GetCustomAttributes (
2276                                 typeof (InheritAttribute), false);
2277                         Assert.AreEqual (1, attrs.Length, "#M1");
2278                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M2");
2279                         attrs = typeof (bug82431B1).GetCustomAttributes (
2280                                 typeof (InheritAttribute), true);
2281                         Assert.AreEqual (1, attrs.Length, "#M3");
2282                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M4");
2283
2284                         attrs = typeof (bug82431B1).GetCustomAttributes (
2285                                 typeof (NotInheritAttribute), false);
2286                         Assert.AreEqual (0, attrs.Length, "#N1");
2287                         attrs = typeof (bug82431B1).GetCustomAttributes (
2288                                 typeof (NotInheritAttribute), true);
2289                         Assert.AreEqual (0, attrs.Length, "#N2");
2290
2291                         attrs = typeof (bug82431B2).GetCustomAttributes (
2292                                 typeof (InheritAttribute), false);
2293                         Assert.AreEqual (0, attrs.Length, "#O1");
2294                         attrs = typeof (bug82431B2).GetCustomAttributes (
2295                                 typeof (InheritAttribute), true);
2296                         Assert.AreEqual (1, attrs.Length, "#O2");
2297                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#O3");
2298
2299                         attrs = typeof (bug82431B2).GetCustomAttributes (
2300                                 typeof (NotInheritAttribute), false);
2301                         Assert.AreEqual (0, attrs.Length, "#P1");
2302                         attrs = typeof (bug82431B2).GetCustomAttributes (
2303                                 typeof (NotInheritAttribute), true);
2304                         Assert.AreEqual (0, attrs.Length, "#P2");
2305
2306                         attrs = typeof (bug82431B3).GetCustomAttributes (
2307                                 typeof (InheritAttribute), false);
2308                         Assert.AreEqual (1, attrs.Length, "#Q1");
2309                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q2");
2310                         attrs = typeof (bug82431B3).GetCustomAttributes (
2311                                 typeof (InheritAttribute), true);
2312                         Assert.AreEqual (2, attrs.Length, "#Q3");
2313                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q4");
2314                         Assert.AreEqual (typeof (InheritAttribute), attrs [1].GetType (), "#Q5");
2315
2316                         attrs = typeof (bug82431B3).GetCustomAttributes (
2317                                 typeof (NotInheritAttribute), false);
2318                         Assert.AreEqual (1, attrs.Length, "#R1");
2319                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R2");
2320                         attrs = typeof (bug82431B3).GetCustomAttributes (
2321                                 typeof (NotInheritAttribute), true);
2322                         Assert.AreEqual (1, attrs.Length, "#R3");
2323                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R4");
2324
2325                         attrs = typeof (bug82431B4).GetCustomAttributes (
2326                                 typeof (InheritAttribute), false);
2327                         Assert.AreEqual (0, attrs.Length, "#S1");
2328                         attrs = typeof (bug82431B4).GetCustomAttributes (
2329                                 typeof (InheritAttribute), true);
2330                         Assert.AreEqual (1, attrs.Length, "#S2");
2331                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#S3");
2332
2333                         attrs = typeof (bug82431B4).GetCustomAttributes (
2334                                 typeof (NotInheritAttribute), false);
2335                         Assert.AreEqual (0, attrs.Length, "#T1");
2336                         attrs = typeof (bug82431B4).GetCustomAttributes (
2337                                 typeof (NotInheritAttribute), true);
2338                         Assert.AreEqual (0, attrs.Length, "#T2");
2339
2340                         attrs = typeof (A).GetCustomAttributes (
2341                                 typeof (string), false);
2342                         Assert.AreEqual (0, attrs.Length, "#U1");
2343                         attrs = typeof (A).GetCustomAttributes (
2344                                 typeof (string), true);
2345                         Assert.AreEqual (0, attrs.Length, "#U2");
2346                 }
2347
2348                 [Test] // bug #76150
2349                 public void IsDefined ()
2350                 {
2351                         Assert.IsTrue (typeof (A).IsDefined (typeof (NemerleAttribute), false), "#A1");
2352                         Assert.IsTrue (typeof (A).IsDefined (typeof (VolatileModifier), false), "#A2");
2353                         Assert.IsTrue (typeof (A).IsDefined (typeof (FooAttribute), false), "#A3");
2354                         Assert.IsFalse (typeof (A).IsDefined (typeof (BarAttribute), false), "#A4");
2355
2356                         Assert.IsFalse (typeof (BA).IsDefined (typeof (NemerleAttribute), false), "#B1");
2357                         Assert.IsFalse (typeof (BA).IsDefined (typeof (VolatileModifier), false), "#B2");
2358                         Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), false), "#B3");
2359                         Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), false), "#B4");
2360                         Assert.IsFalse (typeof (BA).IsDefined (typeof (string), false), "#B5");
2361                         Assert.IsFalse (typeof (BA).IsDefined (typeof (int), false), "#B6");
2362                         Assert.IsTrue (typeof (BA).IsDefined (typeof (NemerleAttribute), true), "#B7");
2363                         Assert.IsTrue (typeof (BA).IsDefined (typeof (VolatileModifier), true), "#B8");
2364                         Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), true), "#B9");
2365                         Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), true), "#B10");
2366                         Assert.IsFalse (typeof (BA).IsDefined (typeof (string), true), "#B11");
2367                         Assert.IsFalse (typeof (BA).IsDefined (typeof (int), true), "#B12");
2368                 }
2369
2370                 [Test]
2371                 public void IsDefined_AttributeType_Null ()
2372                 {
2373                         try {
2374                                 typeof (BA).IsDefined ((Type) null, false);
2375                                 Assert.Fail ("#1");
2376                         } catch (ArgumentNullException ex) {
2377                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2378                                 Assert.IsNull (ex.InnerException, "#3");
2379                                 Assert.IsNotNull (ex.Message, "#4");
2380                                 Assert.IsNotNull (ex.ParamName, "#5");
2381                                 Assert.AreEqual ("attributeType", ex.ParamName, "#6");
2382                         }
2383                 }
2384
2385                 [Test] // bug #82431
2386                 [Category ("NotWorking")]
2387                 public void IsDefined_Inherited ()
2388                 {
2389                         Assert.IsFalse (typeof (CA).IsDefined (typeof (NemerleAttribute), false), "#C1");
2390                         Assert.IsFalse (typeof (CA).IsDefined (typeof (VolatileModifier), false), "#C2");
2391                         Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), false), "#C3");
2392                         Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), false), "#C4");
2393                         Assert.IsTrue (typeof (CA).IsDefined (typeof (NemerleAttribute), true), "#C5");
2394                         Assert.IsTrue (typeof (CA).IsDefined (typeof (VolatileModifier), true), "#C6");
2395                         Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), true), "#C7");
2396                         Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), true), "#C8");
2397
2398                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (NemerleAttribute), false), "#D1");
2399                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (VolatileModifier), false), "#D2");
2400                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), false), "#D3");
2401                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), false), "#D4");
2402                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (NemerleAttribute), true), "#D5");
2403                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (VolatileModifier), true), "#D6");
2404                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2405                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2406
2407                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), false), "#E1");
2408                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), false), "#E2");
2409                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), true), "#E3");
2410                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), true), "#E4");
2411
2412                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), false), "#F1");
2413                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), false), "#F2");
2414                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2415                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), true), "#F4");
2416
2417                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), false), "#G1");
2418                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), false), "#G2");
2419                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), true), "#G3");
2420                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), true), "#G4");
2421
2422                         Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), false), "#H1");
2423                         Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), false), "#H2");
2424                         Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), true), "#H3");
2425                         Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), true), "#H4");
2426
2427                         Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), false), "#I1");
2428                         Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), false), "#I2");
2429                         Assert.IsTrue (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), true), "#I3");
2430                         Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), true), "#I4");
2431
2432                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), false), "#J1");
2433                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), false), "#J2");
2434                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), true), "#J3");
2435                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), true), "#J4");
2436
2437                         Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), false), "#K2");
2438                         Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), false), "#K2");
2439                         Assert.IsTrue (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), true), "#K3");
2440                         Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
2441                 }
2442
2443                 [Test] // GetType (String)
2444                 public void GetType1_TypeName_Null ()
2445                 {
2446                         try {
2447                                 Type.GetType ((string) null);
2448                                 Assert.Fail ("#1");
2449                         } catch (ArgumentNullException ex) {
2450                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2451                                 Assert.IsNull (ex.InnerException, "#3");
2452                                 Assert.IsNotNull (ex.Message, "#4");
2453                                 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2454                         }
2455                 }
2456
2457                 [Test] // GetType (String, Boolean)
2458                 public void GetType2_TypeName_Null ()
2459                 {
2460                         try {
2461                                 Type.GetType ((string) null, false);
2462                                 Assert.Fail ("#1");
2463                         } catch (ArgumentNullException ex) {
2464                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2465                                 Assert.IsNull (ex.InnerException, "#3");
2466                                 Assert.IsNotNull (ex.Message, "#4");
2467                                 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2468                         }
2469                 }
2470
2471                 [Test] // GetType (String, Boolean, Boolean)
2472                 public void GetType3_TypeName_Null ()
2473                 {
2474                         try {
2475                                 Type.GetType ((string) null, false, false);
2476                                 Assert.Fail ("#1");
2477                         } catch (ArgumentNullException ex) {
2478                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2479                                 Assert.IsNull (ex.InnerException, "#3");
2480                                 Assert.IsNotNull (ex.Message, "#4");
2481                                 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2482                         }
2483                 }
2484
2485                 [Test]
2486                 public void GetTypeArray_Args_Null ()
2487                 {
2488                         try {
2489                                 Type.GetTypeArray ((object []) null);
2490                                 Assert.Fail ("#1");
2491                         } catch (ArgumentNullException ex) {
2492                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2493                                 Assert.IsNull (ex.InnerException, "#3");
2494                                 Assert.IsNotNull (ex.Message, "#4");
2495                                 Assert.AreEqual ("args", ex.ParamName, "#5");
2496                         }
2497                 }
2498
2499                 [Test]
2500                 public void GetTypeCode ()
2501                 {
2502                         Assert.AreEqual (TypeCode.Boolean, Type.GetTypeCode (typeof (bool)), "#1");
2503                         Assert.AreEqual (TypeCode.Byte, Type.GetTypeCode (typeof (byte)), "#2");
2504                         Assert.AreEqual (TypeCode.Char, Type.GetTypeCode (typeof (char)), "#3");
2505                         Assert.AreEqual (TypeCode.DateTime, Type.GetTypeCode (typeof (DateTime)), "#4");
2506                         Assert.AreEqual (TypeCode.DBNull, Type.GetTypeCode (typeof (DBNull)), "#5");
2507                         Assert.AreEqual (TypeCode.Decimal, Type.GetTypeCode (typeof (decimal)), "#6");
2508                         Assert.AreEqual (TypeCode.Double, Type.GetTypeCode (typeof (double)), "#7");
2509                         Assert.AreEqual (TypeCode.Empty, Type.GetTypeCode (null), "#8");
2510                         Assert.AreEqual (TypeCode.Int16, Type.GetTypeCode (typeof (short)), "#9");
2511                         Assert.AreEqual (TypeCode.Int32, Type.GetTypeCode (typeof (int)), "#10");
2512                         Assert.AreEqual (TypeCode.Int64, Type.GetTypeCode (typeof (long)), "#11");
2513                         Assert.AreEqual (TypeCode.Object, Type.GetTypeCode (typeof (TakesInt)), "#12");
2514                         Assert.AreEqual (TypeCode.SByte, Type.GetTypeCode (typeof (sbyte)), "#13");
2515                         Assert.AreEqual (TypeCode.Single, Type.GetTypeCode (typeof (float)), "#14");
2516                         Assert.AreEqual (TypeCode.String, Type.GetTypeCode (typeof (string)), "#15");
2517                         Assert.AreEqual (TypeCode.UInt16, Type.GetTypeCode (typeof (ushort)), "#16");
2518                         Assert.AreEqual (TypeCode.UInt32, Type.GetTypeCode (typeof (uint)), "#17");
2519                         Assert.AreEqual (TypeCode.UInt64, Type.GetTypeCode (typeof (ulong)), "#18");
2520                 }
2521
2522                 [Test]
2523                 public void GetTypeFromHandle_Handle_Zero ()
2524                 {
2525                         RuntimeTypeHandle handle = new RuntimeTypeHandle ();
2526
2527                         Assert.IsNull (Type.GetTypeFromHandle (handle));
2528                 }
2529
2530                 [Test]
2531                 public void GetTypeHandle_O_Null ()
2532                 {
2533                         try {
2534                                 Type.GetTypeHandle (null);
2535                                 Assert.Fail ("#1");
2536                         } catch (ArgumentNullException ex) {
2537                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2538                                 Assert.IsNull (ex.InnerException, "#3");
2539                                 Assert.IsNotNull (ex.Message, "#4");
2540                                 Assert.IsNull (ex.ParamName, "#5");
2541                         }
2542                 }
2543
2544                 [Test] // GetConstructor (Type [])
2545                 public void GetConstructor1 ()
2546                 {
2547                         Type type;
2548                         ConstructorInfo ctor;
2549
2550                         type = typeof (CtorsA);
2551                         ctor = type.GetConstructor (Type.EmptyTypes);
2552                         Assert.IsNotNull (ctor, "#A1");
2553                         Assert.AreEqual (0, ctor.GetParameters ().Length, "#A2");
2554                         Assert.IsFalse (ctor.IsStatic, "#A3");
2555                         Assert.IsTrue (ctor.IsPublic, "#A4");
2556                         Assert.AreEqual (".ctor", ctor.Name, "#A5");
2557
2558                         type = typeof (CtorsB);
2559                         ctor = type.GetConstructor (Type.EmptyTypes);
2560                         Assert.IsNotNull (ctor, "#B1");
2561                         Assert.AreEqual (0, ctor.GetParameters ().Length, "#B2");
2562                         Assert.IsFalse (ctor.IsStatic, "#B3");
2563                         Assert.IsTrue (ctor.IsPublic, "#B4");
2564                         Assert.AreEqual (".ctor", ctor.Name, "#B5");
2565
2566                         type = typeof (CtorsC);
2567                         ctor = type.GetConstructor (Type.EmptyTypes);
2568                         Assert.IsNull (ctor, "#C");
2569
2570                         type = typeof (CtorsC);
2571                         ctor = type.GetConstructor (new Type [] { typeof (int) });
2572                         Assert.IsNotNull (ctor, "#D1");
2573                         Assert.AreEqual (1, ctor.GetParameters ().Length, "#D2");
2574                         Assert.IsFalse (ctor.IsStatic, "#D3");
2575                         Assert.IsTrue (ctor.IsPublic, "#D4");
2576                         Assert.AreEqual (".ctor", ctor.Name, "#D5");
2577                 }
2578
2579                 [Test] // GetConstructor (Type [])
2580                 public void GetConstructor1_Types_Null ()
2581                 {
2582                         try {
2583                                 typeof (BindingFlags).GetConstructor (null);
2584                                 Assert.Fail ("#1");
2585                         } catch (ArgumentNullException ex) {
2586                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2587                                 Assert.IsNull (ex.InnerException, "#3");
2588                                 Assert.IsNotNull (ex.Message, "#4");
2589                                 Assert.IsNotNull (ex.ParamName, "#5");
2590                                 Assert.AreEqual ("types", ex.ParamName, "#6");
2591                         }
2592                 }
2593
2594                 [Test] // GetConstructor (Type [])
2595                 public void GetConstructor1_Types_ItemNull ()
2596                 {
2597                         Type type = typeof (BindingFlags);
2598                         try {
2599                                 type.GetConstructor (new Type[1] { null });
2600                                 Assert.Fail ("#A1");
2601                         } catch (ArgumentNullException ex) {
2602                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
2603                                 Assert.IsNull (ex.InnerException, "#A3");
2604                                 Assert.IsNotNull (ex.Message, "#A4");
2605                                 Assert.IsNotNull (ex.ParamName, "#A5");
2606                                 Assert.AreEqual ("types", ex.ParamName, "#A6");
2607                         }
2608
2609                         type = typeof (TakesInt);
2610                         try {
2611                                 type.GetConstructor (new Type [1] { null });
2612                                 Assert.Fail ("#B1");
2613                         } catch (ArgumentNullException ex) {
2614                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2615                                 Assert.IsNull (ex.InnerException, "#B3");
2616                                 Assert.IsNotNull (ex.Message, "#B4");
2617                                 Assert.IsNotNull (ex.ParamName, "#B5");
2618                                 Assert.AreEqual ("types", ex.ParamName, "#B6");
2619                         }
2620                 }
2621
2622                 [Test] // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier [])
2623                 public void GetConstructor2_Types_ItemNull ()
2624                 {
2625                         Type type = typeof (BindingFlags);
2626                         try {
2627                                 type.GetConstructor (BindingFlags.Default, null,
2628                                         new Type[1] { null }, null);
2629                                 Assert.Fail ("#1");
2630                         } catch (ArgumentNullException ex) {
2631                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2632                                 Assert.IsNull (ex.InnerException, "#3");
2633                                 Assert.IsNotNull (ex.Message, "#4");
2634                                 Assert.IsNotNull (ex.ParamName, "#5");
2635                                 Assert.AreEqual ("types", ex.ParamName, "#6");
2636                         }
2637                 }
2638
2639                 [Test] // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier [])
2640                 public void GetConstructor3_Types_ItemNull ()
2641                 {
2642                         Type type = typeof (BindingFlags);
2643                         try {
2644                                 type.GetConstructor (BindingFlags.Default,
2645                                         null, CallingConventions.Any,
2646                                         new Type[1] { null }, null);
2647                                 Assert.Fail ("#1");
2648                         } catch (ArgumentNullException ex) {
2649                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2650                                 Assert.IsNull (ex.InnerException, "#3");
2651                                 Assert.IsNotNull (ex.Message, "#4");
2652                                 Assert.IsNotNull (ex.ParamName, "#5");
2653                                 Assert.AreEqual ("types", ex.ParamName, "#6");
2654                         }
2655                 }
2656
2657                 [Test]
2658                 public void GetMethod_Bug77367 ()
2659                 {
2660                         MethodInfo i = typeof (Bug77367).GetMethod ("Run", Type.EmptyTypes);
2661                         Assert.IsNull (i);
2662                 }
2663
2664 #if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM
2665                 [Test]
2666                 public void EqualsUnderlyingType ()
2667                 {
2668                         AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
2669                         TypeAttributes attribs = TypeAttributes.Public;
2670
2671                         AssemblyName name = new AssemblyName ();
2672                         name.Name = "enumtest";
2673                         AssemblyBuilder assembly = 
2674                                 AppDomain.CurrentDomain.DefineDynamicAssembly (
2675                                         name, access);
2676
2677                         ModuleBuilder module = assembly.DefineDynamicModule 
2678                                 ("m", "enumtest.dll");
2679                         EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
2680
2681                         Assert.IsTrue (typeof (int).Equals (e));
2682                 }
2683 #endif // TARGET_JVM
2684
2685                 [Test]
2686                 public void Equals_Type_Null ()
2687                 {
2688                         Assert.IsFalse (typeof (int).Equals ((Type) null), "#1");
2689                         Assert.IsFalse (typeof (int).Equals ((object) null), "#2");
2690                 }
2691
2692                 [Test]
2693                 public void GetElementType_Bug63841 ()
2694                 {
2695                         Assert.IsNull (typeof (TheEnum).GetElementType (), "#1");
2696                 }
2697
2698                 [Test]
2699                 public void FullNameGenerics ()
2700                 {
2701                         Type fooType = typeof (Foo<>);
2702                         FieldInfo [] fields = fooType.GetFields ();
2703
2704                         Assert.AreEqual (1, fields.Length, "#0");
2705
2706                         Assert.IsNotNull (fooType.FullName, "#1");
2707                         Assert.IsNotNull (fooType.AssemblyQualifiedName, "#1a");
2708
2709                         FieldInfo field = fooType.GetField ("Whatever");
2710                         Assert.IsNotNull (field, "#2");
2711                         Assert.AreEqual (field, fields [0], "#2a");
2712                         Assert.IsNull (field.FieldType.FullName, "#3");
2713                         Assert.IsNull (field.FieldType.AssemblyQualifiedName, "#3a");
2714                         Assert.IsNotNull (field.FieldType.ToString (), "#4");
2715
2716                         PropertyInfo prop = fooType.GetProperty ("Test");
2717                         Assert.IsNotNull (prop, "#5");
2718                         Assert.IsNull (prop.PropertyType.FullName, "#6");
2719                         Assert.IsNull (prop.PropertyType.AssemblyQualifiedName, "#6a");
2720                         Assert.IsNotNull (prop.PropertyType.ToString (), "#7");
2721
2722                         MethodInfo method = fooType.GetMethod("Execute");
2723                         Assert.IsNotNull (method, "#8");
2724                         Assert.IsNull (method.ReturnType.FullName, "#9");
2725                         Assert.IsNull (method.ReturnType.AssemblyQualifiedName, "#9a");
2726                         Assert.IsNotNull (method.ReturnType.ToString (), "#10");
2727
2728                         ParameterInfo[] parameters = method.GetParameters();
2729                         Assert.AreEqual (1, parameters.Length, "#11");
2730                         Assert.IsNull (parameters[0].ParameterType.FullName, "#12");
2731                         Assert.IsNull (parameters[0].ParameterType.AssemblyQualifiedName, "#12a");
2732                         Assert.IsNotNull (parameters[0].ParameterType.ToString (), "#13");
2733                 }
2734
2735                 [Test]
2736                 public void TypeParameterIsNotGeneric ()
2737                 {
2738                         Type fooType = typeof (Foo<>);
2739                         Type type_param = fooType.GetGenericArguments () [0];
2740                         Assert.IsTrue (type_param.IsGenericParameter);
2741                         Assert.IsFalse (type_param.IsGenericType);
2742                         Assert.IsFalse (type_param.IsGenericTypeDefinition);
2743
2744                         // LAMESPEC: MSDN claims that this should be false, but .NET v2.0.50727 says it's true
2745                         // http://msdn2.microsoft.com/en-us/library/system.type.isgenerictype.aspx
2746                         Assert.IsTrue (type_param.ContainsGenericParameters);
2747                 }
2748
2749                 [Test]
2750                 public void IsAssignable ()
2751                 {
2752                         Type foo_type = typeof (Foo<>);
2753                         Type foo_int_type = typeof (Foo<int>);
2754                         Assert.IsFalse (foo_type.IsAssignableFrom (foo_int_type), "Foo<int> -!-> Foo<>");
2755                         Assert.IsFalse (foo_int_type.IsAssignableFrom (foo_type), "Foo<> -!-> Foo<int>");
2756
2757                         Type ibar_short_type = typeof (IBar<short>);
2758                         Type ibar_int_type = typeof (IBar<int>);
2759                         Type baz_short_type = typeof (Baz<short>);
2760                         Type baz_int_type = typeof (Baz<int>);
2761
2762                         Assert.IsTrue (ibar_int_type.IsAssignableFrom (baz_int_type), "Baz<int> -> IBar<int>");
2763                         Assert.IsTrue (ibar_short_type.IsAssignableFrom (baz_short_type), "Baz<short> -> IBar<short>");
2764
2765                         Assert.IsFalse (ibar_int_type.IsAssignableFrom (baz_short_type), "Baz<short> -!-> IBar<int>");
2766                         Assert.IsFalse (ibar_short_type.IsAssignableFrom (baz_int_type), "Baz<int> -!-> IBar<short>");
2767
2768                         // Nullable tests
2769                         Assert.IsTrue (typeof (Nullable<int>).IsAssignableFrom (typeof (int)));
2770                         Assert.IsFalse (typeof (int).IsAssignableFrom (typeof (Nullable<int>)));
2771                         Assert.IsTrue (typeof (Nullable<FooStruct>).IsAssignableFrom (typeof (FooStruct)));
2772                 }
2773
2774                 [Test]
2775                 public void IsInstanceOf ()
2776                 {
2777                         Assert.IsTrue (typeof (Nullable<int>).IsInstanceOfType (5));
2778                 }
2779
2780                 [Test]
2781                 public void IsInstanceOfArrayOfNullable ()
2782                 {
2783                         Assert.IsTrue (typeof (Nullable<int>[]).IsInstanceOfType (new Nullable<int> [0]));
2784                 }
2785
2786                 [Test]
2787                 public void IsInstanceOfType_Null ()
2788                 {
2789                         Assert.IsFalse (typeof (int).IsInstanceOfType (null), "int");
2790                         Assert.IsFalse (typeof (object).IsInstanceOfType (null), "object");
2791                         Assert.IsFalse (typeof (int?).IsInstanceOfType (null), "int?");
2792                 }
2793
2794                 [Test]
2795                 public void ByrefType ()
2796                 {
2797                         Type foo_type = typeof (Foo<>);
2798                         Type type_param = foo_type.GetGenericArguments () [0];
2799                         Type byref_type_param = type_param.MakeByRefType ();
2800                         Assert.IsFalse (byref_type_param.IsGenericParameter);
2801                         Assert.IsNull (byref_type_param.DeclaringType);
2802                 }
2803
2804                 [Test]
2805                 [ExpectedException (typeof (TypeLoadException))]
2806                 public void MakeByRefByRef ()
2807                 {
2808                         typeof (int).MakeByRefType ().MakeByRefType ();
2809                 }
2810
2811                 [Test]
2812                 public void MakeArrayTypeTest ()
2813                 {
2814                         // This should not crash:
2815                         typeof (void).MakeArrayType ();
2816                 }
2817                 
2818
2819                 [ComVisible (true)]
2820                 public class ComFoo<T> {
2821                 }
2822
2823                 [Test]
2824                 public void GetCustomAttributesGenericInstance ()
2825                 {
2826                         Assert.AreEqual (1, typeof (ComFoo<int>).GetCustomAttributes (typeof (ComVisibleAttribute), true).Length);
2827                 }
2828
2829                 interface ByRef1<T> { void f (ref T t); }
2830                 interface ByRef2 { void f<T> (ref T t); }
2831
2832                 interface ByRef3<T> where T:struct { void f (ref T? t); }
2833                 interface ByRef4 { void f<T> (ref T? t) where T:struct; }
2834
2835                 void CheckGenericByRef (Type t)
2836                 {
2837                         string name = t.Name;
2838                         t = t.GetMethod ("f").GetParameters () [0].ParameterType;
2839
2840                         Assert.IsFalse (t.IsGenericType, name);
2841                         Assert.IsFalse (t.IsGenericTypeDefinition, name);
2842                         Assert.IsFalse (t.IsGenericParameter, name);
2843                 }
2844
2845                 [Test]
2846                 public void GenericByRef ()
2847                 {
2848                         CheckGenericByRef (typeof (ByRef1<>));
2849                         CheckGenericByRef (typeof (ByRef2));
2850                         CheckGenericByRef (typeof (ByRef3<>));
2851                         CheckGenericByRef (typeof (ByRef4));
2852                 }
2853
2854                 public class Bug80242<T> {
2855                         public interface IFoo { }
2856                         public class Bar : IFoo { }
2857                         public class Baz : Bar { }
2858                 }
2859
2860                 [Test]
2861                 public void TestNestedTypes ()
2862                 {
2863                         Type t = typeof (Bug80242<object>);
2864                         Assert.IsFalse (t.IsGenericTypeDefinition);
2865                         foreach (Type u in t.GetNestedTypes ()) {
2866                                 Assert.IsTrue (u.IsGenericTypeDefinition, "{0} isn't a generic definition", u);
2867                                 Assert.AreEqual (u, u.GetGenericArguments () [0].DeclaringType);
2868                         }
2869                 }
2870
2871                 [Test] // bug #82211
2872                 public void GetMembers_GenericArgument ()
2873                 {
2874                         Type argType = typeof (ComFoo<>).GetGenericArguments () [0];
2875                         MemberInfo [] members = argType.GetMembers ();
2876                         Assert.IsNotNull (members, "#1");
2877                         Assert.AreEqual (4, members.Length, "#2");
2878                 }
2879
2880                 [Test]
2881                 [ExpectedException (typeof (ArgumentNullException))]
2882                 public void ReflectionOnlyGetTypeNullTypeName ()
2883                 {
2884                         Type.ReflectionOnlyGetType (null, false, false);
2885                 }
2886
2887                 [Test]
2888                 public void ReflectionOnlyGetTypeDoNotThrow ()
2889                 {
2890                         Assert.IsNull (Type.ReflectionOnlyGetType ("a, nonexistent.dll", false, false));
2891                 }
2892
2893                 [Test]
2894                 [ExpectedException (typeof (FileNotFoundException))]
2895                 public void ReflectionOnlyGetTypeThrow ()
2896                 {
2897                         Type.ReflectionOnlyGetType ("a, nonexistent.dll", true, false);
2898                 }
2899
2900                 [Test]
2901                 public void ReflectionOnlyGetType ()
2902                 {
2903                         Type t = Type.ReflectionOnlyGetType (typeof (int).AssemblyQualifiedName.ToString (), true, true);
2904                         Assert.AreEqual ("System.Int32", t.FullName);
2905                 }
2906
2907                 [Test] //bug #331199
2908                 public void MakeGenericType_UserDefinedType ()
2909                 {
2910                         Type ut = new UserType (typeof (int));
2911                         Type t = typeof (Foo<>).MakeGenericType (ut);
2912                         Assert.IsTrue (t.IsGenericType, "#A1");
2913                         Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2914
2915                         Type arg = t.GetGenericArguments () [0];
2916                         Assert.IsNotNull (arg, "#B1");
2917                         Assert.IsFalse (arg.IsGenericType, "#B2");
2918                         Assert.AreEqual (ut, arg, "#B3");
2919                 }
2920
2921                 [Category ("NotWorking")]
2922                 //We dont support instantiating a user type 
2923                 public void MakeGenericType_NestedUserDefinedType ()
2924                 {
2925                         Type ut = new UserType (new UserType (typeof (int)));
2926                         Type t = typeof (Foo<>).MakeGenericType (ut);
2927                         Assert.IsTrue (t.IsGenericType, "#A1");
2928                         Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2929
2930                         Type arg = t.GetGenericArguments () [0];
2931                         Assert.IsNotNull (arg, "#B1");
2932                         Assert.IsFalse (arg.IsGenericType, "#B2");
2933                         Assert.AreEqual (ut, arg, "#B3");
2934                 }
2935                 
2936                 [Test]
2937                 [Category ("NotWorking")]
2938                 public void TestMakeGenericType_UserDefinedType_DotNet20SP1 () 
2939                 {
2940                         Type ut = new UserType(typeof(int));
2941                         Type t = typeof(Foo<>).MakeGenericType(ut);
2942                         Assert.IsTrue (t.IsGenericType, "#1");
2943
2944                         Assert.AreEqual (ut, t.GetGenericArguments()[0], "#2");
2945                 }
2946                 
2947                 [Test]
2948                 public void MakeGenericType_BadUserType ()
2949                 {
2950                         Type ut = new UserType (null);
2951                         try {
2952                                 Type t = typeof (Foo<>).MakeGenericType (ut);
2953                                 Assert.Fail ("#1");
2954                         } catch (ArgumentException) {
2955                         }
2956                 }
2957         
2958                 [Test]
2959                 public void MakeGenericType_WrongNumOfArguments ()
2960                 {
2961                         try {
2962                                 Type t = typeof (Foo<,>).MakeGenericType (new Type [] { typeof (int) });
2963                                 Assert.Fail ("#1");
2964                         } catch (ArgumentException) {
2965                         }
2966                 }
2967
2968                 [AttributeUsage (AttributeTargets.All)]
2969                 public class DocAttribute : Attribute {
2970                         public DocAttribute (string docs) {}
2971                 }
2972                 
2973                 class GenericClassWithAttributes<[Doc ("T")] T, [Doc ("B")] B> 
2974                         where T : class, new ()
2975                         where B : Attribute
2976                 {
2977                         public T Bar { get{return null;}}
2978
2979                         public void M<[Doc ("X")] X> (X x)
2980                         {
2981                         }
2982                 }
2983         
2984                 [Test] //bug #377596
2985                 public void GetGenericArguments_ArgumentsHaveAttributes ()
2986                 {
2987                         Type type = typeof(GenericClassWithAttributes<,>);
2988                         Type[] tArgs = type.GetGenericArguments ();
2989                         MethodInfo m = type.GetMethod ("M");
2990                         Type[] mArgs = m.GetGenericArguments ();
2991                         Assert.AreEqual(1, tArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2992                         Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2993                         Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2994                 }
2995
2996                 [Test] //bug #471255
2997                 public void GetTypeCalledUsingReflection ()
2998                 {
2999                         Type expectedType = Type.GetType ("NoNamespaceClass");
3000                         Assert.IsNotNull (expectedType, "#1");
3001                         MethodInfo m = typeof (Type).GetMethod ("GetType",  BindingFlags.Public | BindingFlags.Static, null, new Type [] { typeof (string) },  null);
3002                         object r = m.Invoke (null, BindingFlags.Default, null, new object [] { "NoNamespaceClass" }, CultureInfo.InvariantCulture);
3003                         Assert.AreSame (expectedType, r, "#2");
3004                 }
3005
3006         [Test]
3007         public void EqualsUserType () {
3008                 UserType2 t1 = new UserType2(null);
3009                 UserType2 t2 = new UserType2(t1);
3010                 Assert.IsTrue (t1.Equals(t2));
3011         }
3012
3013         [Test]
3014         public void GetHashCodeUserType () {
3015                 UserType2 t1 = new UserType2(null);
3016                 UserType2 t2 = new UserType2(t1);
3017                 Assert.AreEqual (42, t2.GetHashCode());
3018         }
3019         
3020         [Test]
3021         public void IsGenericTypeDefinitionUserType () {
3022                 Assert.IsFalse (new UserType(null).IsGenericTypeDefinition);
3023         }
3024         
3025         [Test]
3026         public void IsGenericTypeUserType () {
3027                 Assert.IsFalse (new UserType(null).IsGenericType);
3028         }
3029
3030         [Test]
3031         [ExpectedException (typeof (NotSupportedException))]
3032         public void GetGenericTypeDefinitionUserType () {
3033                 new UserType(null).GetGenericTypeDefinition ();
3034         }
3035
3036         [ExpectedException (typeof (NotSupportedException))]
3037         public void GetGenericArgumentsUserType () {
3038                 new UserType(null).GetGenericArguments ();
3039         }
3040         
3041         [Test]
3042         [ExpectedException (typeof (InvalidOperationException))]
3043         public void GenericParameterPositionUserType () {
3044                 Assert.IsTrue (new UserType(null).GenericParameterPosition == 0);
3045         }
3046
3047                 [Test]
3048                 public void TypeGetMemberReturnTypeTest ()
3049                 {
3050                         object obj;
3051                         MemberTypes memtype;
3052                         Type testtype;
3053                         object [] flagsandtypes = new object [] {
3054                                 MemberTypes.All, typeof (MemberInfo []),
3055                                 MemberTypes.Constructor, typeof (ConstructorInfo []),
3056                                 MemberTypes.Custom, typeof (MemberInfo []),
3057                                 MemberTypes.Event, typeof (EventInfo []),
3058                                 MemberTypes.Field, typeof (FieldInfo []),
3059                                 MemberTypes.Method, typeof (MethodInfo []),
3060                                 MemberTypes.NestedType, typeof (Type []),
3061                                 MemberTypes.Property, typeof (PropertyInfo []),
3062                                 MemberTypes.TypeInfo, typeof (Type [])};
3063
3064                         for (int i=0; i < flagsandtypes.Length; i+=2) {
3065                                 memtype = (MemberTypes)flagsandtypes [i];
3066                                 testtype = (Type)flagsandtypes [i+1];
3067                                 obj = GetType ().GetMember ("DummyMember", memtype,
3068                                                 BindingFlags.Public | BindingFlags.Instance);
3069                                 Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
3070                                                 "Expected " + testtype.FullName);
3071                         }
3072
3073                 }
3074  
3075                 [Test]
3076                 public void TypeNameStartsWithSpace ()
3077                 {
3078                         Type t1 = Type.GetType ("System.Type, mscorlib");
3079                         Type t2 = Type.GetType (" System.Type, mscorlib");
3080                         Assert.AreEqual (t1, t2);
3081                 }
3082
3083
3084                 [Test]
3085                 public void Bug506757 ()
3086                 {
3087                         AssemblyName assemblyName = new AssemblyName ();
3088                         assemblyName.Name = "customMod";
3089                         assemblyName.Version = new Version (1, 2, 3, 4);
3090         
3091                         AssemblyBuilder assembly 
3092                                 = Thread.GetDomain().DefineDynamicAssembly(
3093                                           assemblyName, AssemblyBuilderAccess.RunAndSave);
3094         
3095                         ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
3096         
3097                         TypeBuilder type0 = module.DefineType ("Base", TypeAttributes.Public, typeof (object));
3098                         TypeBuilder type1 = module.DefineType ("Middle", TypeAttributes.Public, type0);
3099                         TypeBuilder type2 = module.DefineType ("End", TypeAttributes.Public, type1);
3100         
3101                         MethodAttributes attrs0 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3102                                                   MethodAttributes.NewSlot | MethodAttributes.FamORAssem;
3103         
3104                         MethodAttributes attrs1 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3105                                                   MethodAttributes.FamORAssem;
3106         
3107                         MethodAttributes attrs2 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3108                                                   MethodAttributes.Public;
3109         
3110         
3111                         MethodBuilder m0 = type0.DefineMethod ("Tst", attrs0, typeof (void), null);
3112                         m0.GetILGenerator ().Emit (OpCodes.Ret);
3113         
3114                         MethodBuilder m1 = type1.DefineMethod ("Tst", attrs1, typeof (void), null);
3115                         m1.GetILGenerator ().Emit (OpCodes.Ret);
3116         
3117                         MethodBuilder m2 = type2.DefineMethod ("Tst", attrs2, typeof (void), null);
3118                         m2.GetILGenerator ().Emit (OpCodes.Ret);
3119         
3120         
3121                         type0.CreateType ();
3122                         type1.CreateType ();
3123                         Type t2 = type2.CreateType ();
3124         
3125                         foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
3126                                 Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
3127                 }
3128
3129                 [Test]
3130                 public void MakeArrayTypeOfOneDimension ()
3131                 {
3132                         Type vector = typeof (int).MakeArrayType ();
3133                         Type szarray = typeof (int).MakeArrayType (1);
3134
3135                         Assert.AreNotEqual (vector, szarray, "#1");
3136                         Assert.AreEqual ("Int32[]", vector.Name, "#2");
3137                         Assert.AreEqual ("Int32[*]", szarray.Name, "#3");
3138                 }
3139
3140                 public class DeclaringMethodFoo {
3141                         public void Test<T> (T t) {}
3142                         public void Test2<T> (ref T t) {}
3143                 }
3144
3145                 public class DeclaringMethodBar<T> {
3146                         public void Test2 (ref T t) {}
3147                 }
3148
3149                 [Test]
3150                 public void DeclaringMethodOnlyWorksWithGenericArgs ()
3151                 {
3152                 MethodInfo testMethod = typeof (DeclaringMethodFoo).GetMethod ("Test");
3153                 MethodBase otherMethod = testMethod.GetParameters ()[0].ParameterType.DeclaringMethod;
3154
3155                         Assert.AreEqual (testMethod, otherMethod,"#1");
3156
3157                         Assert.IsNull (typeof (DeclaringMethodBar<>).GetGenericArguments ()[0].DeclaringMethod, "#2");
3158
3159                         try {
3160                                 var x = typeof (int).DeclaringMethod;
3161                                 Assert.Fail ("#3");
3162                         } catch (InvalidOperationException) {}
3163
3164                         try {
3165                                 var x = typeof (DeclaringMethodFoo).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3166                                 Assert.Fail ("#4");
3167                         } catch (InvalidOperationException) {}
3168
3169                         try {
3170                                 var x = typeof (DeclaringMethodBar<>).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3171                                 Assert.Fail ("#5");
3172                         } catch (InvalidOperationException) {}
3173
3174                 }
3175
3176                 [Test]
3177                 public void GetArrayRankThrowsForNonArrayType ()
3178                 {
3179                         Assert.AreEqual (1, typeof (int[]).GetArrayRank (), "#1");
3180                         Assert.AreEqual (2, typeof (int[,]).GetArrayRank (), "#2");
3181                         try {
3182                                 typeof (int).GetArrayRank ();
3183                                 Assert.Fail ("#3");
3184                         } catch (ArgumentException) {}
3185                 }
3186
3187                 [Test] //Bug #564379
3188                 public void GetMethodsReturnPublicMethodsInInterfaces ()
3189                 {
3190                         Type t = typeof (NonClosingStream);
3191                         MethodInfo[] methods = t.GetMethods (BindingFlags.Public | BindingFlags.Instance);
3192
3193                         Assert.AreEqual (5, methods.Length, "#1");
3194                         int id = 2;
3195
3196                         foreach (var m in methods) {
3197                                 if (m.Name.Equals ("ToString"))
3198                                         Assert.IsTrue (m.DeclaringType == typeof (NonClosingStream), "#" + id);
3199                                 else if (m.Name.Equals ("Dispose") && m.GetParameters ().Length == 0)
3200                                         Assert.IsTrue (m.DeclaringType == typeof (Stream), "#" + id);
3201                                 else if (m.Name.Equals ("Equals") || m.Name.Equals ("GetHashCode") || m.Name.Equals ("GetType"))
3202                                         Assert.IsTrue (m.DeclaringType == typeof (object), "#" + id);
3203                                 else
3204                                         Assert.Fail ("invalid method " + m);
3205                                 ++id;
3206                         }
3207                 }
3208
3209 #if NET_4_0
3210                 interface IGetInterfaceMap<in T>
3211                 {
3212                     string Bar (T t);
3213                 }
3214
3215                 class GetInterfaceMap : IGetInterfaceMap<object>
3216                 {
3217                     public string Bar (object t)
3218                     {
3219                         return t.GetType ().FullName;
3220                     }
3221                 }
3222
3223                 [Test]
3224                 public void GetInterfaceMapWorksWithVariantIfaces ()
3225                 {
3226                         InterfaceMapping res = typeof (GetInterfaceMap).GetInterfaceMap (typeof (IGetInterfaceMap <object>));
3227                         Assert.AreEqual (typeof (IGetInterfaceMap <object>), res.InterfaceType);
3228                         Assert.AreEqual (typeof (object), res.InterfaceMethods [0].GetParameters () [0].ParameterType);
3229
3230                         res = typeof (GetInterfaceMap).GetInterfaceMap (typeof (IGetInterfaceMap <string>));
3231                         Assert.AreEqual (typeof (IGetInterfaceMap <string>), res.InterfaceType);
3232                         Assert.AreEqual (typeof (string), res.InterfaceMethods [0].GetParameters () [0].ParameterType);
3233                 }
3234 #endif
3235
3236                 public abstract class Stream : IDisposable
3237                 {
3238                         public void Dispose ()
3239                         {
3240                                 Console.WriteLine ("stream::dispose");
3241                         }
3242
3243                         protected virtual void Dispose (bool disposing)
3244                         {
3245                         }
3246                 }
3247
3248                 public class NonClosingStream 
3249                         : Stream, IDisposable
3250                 {
3251                         void  IDisposable.Dispose()
3252                         {
3253                                 Console.WriteLine ("ncs::dispose");
3254                         }
3255
3256                         public override string ToString () { return ""; }
3257                 }
3258
3259                 static bool ContainsProperty (PropertyInfo [] props, string name)
3260                 {
3261                         foreach (PropertyInfo p in props)
3262                                 if (p.Name == name)
3263                                         return true;
3264                         return false;
3265                 }
3266
3267                 public class NemerleAttribute : Attribute
3268                 {
3269                 }
3270
3271                 public class VolatileModifier : NemerleAttribute
3272                 {
3273                 }
3274
3275                 [VolatileModifier]
3276                 [FooAttribute]
3277                 class A
3278                 {
3279                 }
3280
3281                 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3282                 public class FooAttribute : Attribute
3283                 {
3284                 }
3285
3286                 public class BarAttribute : FooAttribute
3287                 {
3288                 }
3289
3290                 [BarAttribute]
3291                 class BA : A
3292                 {
3293                 }
3294
3295                 class BBA : BA
3296                 {
3297                 }
3298
3299                 class CA : A
3300                 {
3301                 }
3302
3303                 [AttributeUsage (AttributeTargets.Class, Inherited=true)]
3304                 public class InheritAttribute : Attribute
3305                 {
3306                 }
3307
3308                 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3309                 public class NotInheritAttribute : InheritAttribute
3310                 {
3311                 }
3312
3313                 [NotInheritAttribute]
3314                 public class bug82431A1
3315                 {
3316                 }
3317
3318                 public class bug82431A2 : bug82431A1
3319                 {
3320                 }
3321
3322                 [NotInheritAttribute]
3323                 [InheritAttribute]
3324                 public class bug82431A3 : bug82431A1
3325                 {
3326                 }
3327
3328                 [InheritAttribute]
3329                 public class bug82431B1
3330                 {
3331                 }
3332
3333                 public class bug82431B2 : bug82431B1
3334                 {
3335                 }
3336
3337                 [NotInheritAttribute]
3338                 public class bug82431B3 : bug82431B2
3339                 {
3340                 }
3341
3342                 public class bug82431B4 : bug82431B3
3343                 {
3344                 }
3345
3346                 struct FooStruct
3347                 {
3348                 }
3349
3350                 public class Bug77367
3351                 {
3352                         public void Run (bool b)
3353                         {
3354                         }
3355                 }
3356
3357                 public class Blue
3358                 {
3359                         private string PrivInstBlue
3360                         {
3361                                 get { return null; }
3362                         }
3363
3364                         protected string ProtInstBlue
3365                         {
3366                                 get { return null; }
3367                         }
3368
3369                         protected internal string ProIntInstBlue
3370                         {
3371                                 get { return null; }
3372                         }
3373
3374                         public long PubInstBlue
3375                         {
3376                                 get
3377                                 {
3378                                         if (PrivInstBlue == null)
3379                                                 return 0;
3380                                         return long.MaxValue;
3381                                 }
3382                         }
3383
3384                         internal int IntInstBlue
3385                         {
3386                                 get { return 0; }
3387                         }
3388
3389                         private static string PrivStatBlue
3390                         {
3391                                 get { return null; }
3392                         }
3393
3394                         protected static string ProtStatBlue
3395                         {
3396                                 get { return null; }
3397                         }
3398
3399                         protected static internal string ProIntStatBlue
3400                         {
3401                                 get { return null; }
3402                         }
3403
3404                         public static long PubStatBlue
3405                         {
3406                                 get
3407                                 {
3408                                         if (PrivStatBlue == null)
3409                                                 return 0;
3410                                         return long.MaxValue;
3411                                 }
3412                         }
3413
3414                         internal static int IntStatBlue
3415                         {
3416                                 get { return 0; }
3417                         }
3418                 }
3419
3420                 public class Foo : Blue
3421                 {
3422                         private string PrivInstBase
3423                         {
3424                                 get { return null; }
3425                         }
3426
3427                         protected string ProtInstBase
3428                         {
3429                                 get { return null; }
3430                         }
3431
3432                         protected internal string ProIntInstBase
3433                         {
3434                                 get { return null; }
3435                         }
3436
3437                         public long PubInstBase
3438                         {
3439                                 get
3440                                 {
3441                                         if (PrivInstBase == null)
3442                                                 return 0;
3443                                         return long.MaxValue;
3444                                 }
3445                         }
3446
3447                         internal int IntInstBase
3448                         {
3449                                 get { return 0; }
3450                         }
3451
3452                         private static string PrivStatBase
3453                         {
3454                                 get { return null; }
3455                         }
3456
3457                         protected static string ProtStatBase
3458                         {
3459                                 get { return null; }
3460                         }
3461
3462                         protected static internal string ProIntStatBase
3463                         {
3464                                 get { return null; }
3465                         }
3466
3467                         public static long PubStatBase
3468                         {
3469                                 get
3470                                 {
3471                                         if (PrivStatBase == null)
3472                                                 return 0;
3473                                         return long.MaxValue;
3474                                 }
3475                         }
3476
3477                         internal static int IntStatBase
3478                         {
3479                                 get { return 0; }
3480                         }
3481                 }
3482
3483                 public class Bar : Foo
3484                 {
3485                         private string PrivInst
3486                         {
3487                                 get { return null; }
3488                         }
3489
3490                         protected string ProtInst
3491                         {
3492                                 get { return null; }
3493                         }
3494
3495                         protected internal string ProIntInst
3496                         {
3497                                 get { return null; }
3498                         }
3499
3500                         public long PubInst
3501                         {
3502                                 get
3503                                 {
3504                                         if (PrivInst == null)
3505                                                 return 0;
3506                                         return long.MaxValue;
3507                                 }
3508                         }
3509
3510                         internal int IntInst
3511                         {
3512                                 get { return 0; }
3513                         }
3514
3515                         private static string PrivStat
3516                         {
3517                                 get { return null; }
3518                         }
3519
3520                         protected static string ProtStat
3521                         {
3522                                 get { return null; }
3523                         }
3524
3525                         protected static internal string ProIntStat
3526                         {
3527                                 get { return null; }
3528                         }
3529
3530                         public static long PubStat
3531                         {
3532                                 get
3533                                 {
3534                                         if (PrivStat == null)
3535                                                 return 0;
3536                                         return long.MaxValue;
3537                                 }
3538                         }
3539
3540                         internal static int IntStat
3541                         {
3542                                 get { return 0; }
3543                         }
3544                 }
3545
3546                 class CtorsA
3547                 {
3548                         static CtorsA ()
3549                         {
3550                         }
3551                 }
3552
3553                 class CtorsB
3554                 {
3555                         public CtorsB ()
3556                         {
3557                         }
3558                 }
3559
3560                 class CtorsC
3561                 {
3562                         static CtorsC ()
3563                         {
3564                         }
3565
3566                         public CtorsC (int x)
3567                         {
3568                         }
3569                 }
3570         }
3571
3572         class UserType : Type
3573         {
3574                 protected Type type;
3575         
3576                 public UserType(Type type) {
3577                         this.type = type;
3578                 }
3579         
3580                 public override Type UnderlyingSystemType { get { return this.type; } }
3581         
3582                 public override Assembly Assembly { get { return this.type == null ? null : this.type.Assembly; } }
3583         
3584                 public override string AssemblyQualifiedName { get { return null; } }
3585         
3586                 public override Type BaseType { get { return null; } }
3587         
3588                 public override Module Module { get { return this.type.Module; } }
3589         
3590                 public override string Namespace { get { return null; } }
3591         
3592                 public override bool IsGenericParameter { get { return true; } }
3593          
3594                 public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
3595         
3596                 public override bool ContainsGenericParameters { get { return true; } }
3597         
3598                 public override string FullName { get { return this.type.Name; } }
3599         
3600                 public override Guid GUID { get { throw new NotSupportedException(); } }
3601         
3602         
3603                 protected override bool IsArrayImpl() {
3604                         return false;
3605                 }
3606         
3607                 protected override bool IsByRefImpl()
3608                 {
3609                         return false;
3610                 }
3611         
3612                 protected override bool IsCOMObjectImpl()
3613                 {
3614                         return false;
3615                 }
3616         
3617                 protected override bool IsPointerImpl()
3618                 {
3619                         return false;
3620                 }
3621         
3622                 protected override bool IsPrimitiveImpl()
3623                 {
3624                         return false;
3625                 }
3626         
3627         
3628                 protected override TypeAttributes GetAttributeFlagsImpl()
3629                 {
3630                         return 0;
3631                 }
3632         
3633                 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
3634                                                                            CallingConventions callConvention, Type[] types,
3635                                                                            ParameterModifier[] modifiers)
3636                 {
3637                         return null;
3638                 }
3639         
3640                 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
3641                 {
3642                         return null;
3643                 }
3644         
3645                 public override Type GetElementType()
3646                 {
3647                         return null;
3648                 }
3649         
3650                 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
3651                 {
3652                         return null;
3653                 }
3654         
3655         
3656                 public override FieldInfo GetField(string name, BindingFlags bindingAttr)
3657                 {
3658                         return null;
3659                 }
3660         
3661         
3662                 public override Type GetInterface(string name, bool ignoreCase)
3663                 {
3664                         return null;
3665                 }
3666         
3667                 public override Type[] GetInterfaces()
3668                 {
3669                         return null;
3670                 }
3671         
3672                 public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
3673                 {
3674                         return null;
3675                 }
3676         
3677                 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
3678                 {
3679                         return null;
3680                 }
3681         
3682                 public override object[] GetCustomAttributes(bool inherit)
3683                 {
3684                         return null;
3685                 }
3686         
3687                 public override bool IsDefined(Type attributeType, bool inherit)
3688                 {
3689                         return false;
3690                 }
3691         
3692                 public override string Name { get { return this.type.Name; } }
3693         
3694                 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
3695                 {
3696                         throw new NotImplementedException();
3697                 }
3698         
3699                 public override FieldInfo[] GetFields(BindingFlags bindingAttr)
3700                 {
3701                         throw new NotImplementedException();
3702                 }
3703         
3704                 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
3705                                                                  CallingConventions callConvention, Type[] types,
3706                                                                  ParameterModifier[] modifiers)
3707                 {
3708                         return null;
3709                 }
3710         
3711                 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
3712                 {
3713                         return null;
3714                 }
3715         
3716                 public override Type GetNestedType(string name, BindingFlags bindingAttr)
3717                 {
3718                         return null;
3719                 }
3720         
3721                 public override Type[] GetNestedTypes(BindingFlags bindingAttr)
3722                 {
3723                         return null;
3724                 }
3725         
3726                 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
3727                 {
3728                         return null;
3729                 }
3730         
3731                 protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder,
3732                                                                  Type returnType, Type[] types, ParameterModifier[] modifiers)
3733                 {
3734                         return null;
3735                 }
3736         
3737                 protected override bool HasElementTypeImpl()
3738                 {
3739                         return false;
3740                 }
3741         
3742                 public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target,
3743                                                          object[] args, ParameterModifier[] modifiers, CultureInfo culture,
3744                                                          string[] namedParameters)
3745                 {
3746                         throw new NotSupportedException();
3747                 }
3748         }
3749
3750     class UserType2 : UserType {
3751                 public UserType2 (Type type) : base (type) {
3752                 }
3753
3754                 public override Type UnderlyingSystemType { get { return this.type ?? this; } }
3755
3756                 public override int GetHashCode()
3757                 {
3758                         if (type == null)
3759                                 return 42;
3760                         return type.GetHashCode();
3761                 }
3762         }
3763 }