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