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