1 // TypeTest.cs - NUnit Test Cases for the System.Type class
4 // Zoltan Varga (vargaz@freemail.hu)
7 // (C) 2003 Ximian, Inc. http://www.ximian.com
10 using NUnit.Framework;
12 using System.Threading;
13 using System.Collections;
15 using System.Collections.Generic;
18 using System.Reflection;
19 using System.Reflection.Emit;
20 using System.Runtime.InteropServices;
22 using System.Globalization;
24 class NoNamespaceClass {
27 namespace MonoTests.System
29 class Super : ICloneable
31 public virtual object Clone ()
46 interface IFace2 : IFace1
51 interface IFace3 : IFace2
66 public abstract int this [byte i] {
70 public abstract int this [int i] {
74 public abstract void TestVoid ();
75 public abstract void TestInt (int i);
78 class DeriveVTable : Base
80 public override int this [byte i] {
84 public override int this [int i] {
88 public override void TestVoid ()
93 public override void TestInt (int i)
99 class NewVTable : DeriveVTable
101 public new int this [byte i] {
105 public new int this [int i] {
109 public new void TestVoid ()
114 public new void TestInt (int i)
119 public void Overload ()
123 public void Overload (int i)
127 public NewVTable (out int i)
132 public void byref_method (out int i)
140 public virtual int Foo {
146 class Derived1 : Base1
148 public override int Foo {
153 class Derived2 : Base1
167 get { throw new NotImplementedException (); }
170 public T Execute (T a)
180 public interface IBar<T>
184 public class Baz<T> : IBar<T>
188 public class Bug348522
190 public void Test (int __argument)
195 public class FirstMethodBinder : Binder
197 public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase [] match, ref object [] args,
198 ParameterModifier [] modifiers, CultureInfo culture, string [] names,
205 public override object ChangeType (object value, Type type1, CultureInfo culture)
210 // The rest is just to please the compiler
211 public override FieldInfo BindToField (BindingFlags a, FieldInfo[] b, object c, CultureInfo d)
216 public override void ReorderArgumentArray(ref object[] a, object b)
220 public override MethodBase SelectMethod(BindingFlags a, MethodBase[] b, Type[] c, ParameterModifier[] d)
225 public override PropertyInfo SelectProperty(BindingFlags a, PropertyInfo[] b, Type c, Type[] d, ParameterModifier[] e)
233 public class TypeTest
235 private AssemblyBuilder assembly;
236 private ModuleBuilder module;
237 const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
238 static int typeIndexer = 0;
243 AssemblyName assemblyName = new AssemblyName ();
244 assemblyName.Name = ASSEMBLY_NAME;
245 assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
246 assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
247 module = assembly.DefineDynamicModule ("module1");
250 private string genTypeName ()
252 return "t" + (typeIndexer++);
255 private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k)
259 private void GenericMethod<Q> (Q q)
264 public void TestIsAssignableFrom ()
266 // Simple tests for inheritance
267 Assert.AreEqual (typeof (Super).IsAssignableFrom (typeof (Duper)) , true, "#01");
268 Assert.AreEqual (typeof (Duper).IsAssignableFrom (typeof (Duper)), true, "#02");
269 Assert.AreEqual (typeof (Object).IsAssignableFrom (typeof (Duper)), true, "#03");
270 Assert.AreEqual (typeof (ICloneable).IsAssignableFrom (typeof (Duper)), true, "#04");
273 Assert.AreEqual (typeof (Super[]).IsAssignableFrom (typeof (Duper[])), true, "#05");
274 Assert.AreEqual (typeof (Duper[]).IsAssignableFrom (typeof (Super[])), false, "#06");
275 Assert.AreEqual (typeof (Object[]).IsAssignableFrom (typeof (Duper[])), true, "#07");
276 Assert.AreEqual (typeof (ICloneable[]).IsAssignableFrom (typeof (Duper[])), true, "#08");
278 // Tests for multiple dimensional arrays
279 Assert.AreEqual (typeof (Super[][]).IsAssignableFrom (typeof (Duper[][])), true, "#09");
280 Assert.AreEqual (typeof (Duper[][]).IsAssignableFrom (typeof (Super[][])), false, "#10");
281 Assert.AreEqual (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])), true, "#11");
282 Assert.AreEqual (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])), true, "#12");
284 // Tests for vectors<->one dimensional arrays */
285 #if TARGET_JVM // Lower bounds arrays are not supported for TARGET_JVM.
286 Array arr1 = Array.CreateInstance (typeof (int), new int[] {1});
287 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
289 Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
290 Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
292 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
293 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false, "#14");
296 // Test that arrays of enums can be cast to their base types
297 Assert.AreEqual (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])), true, "#15");
299 // Test that arrays of valuetypes can't be cast to arrays of
301 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TypeCode[])), false, "#16");
302 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TypeCode[])), false, "#17");
303 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TypeCode[])), false, "#18");
305 // Test that arrays of enums can't be cast to arrays of references
306 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TheEnum[])), false, "#19");
307 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TheEnum[])), false, "#20");
308 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TheEnum[])), false, "#21");
310 // Check that ValueType and Enum are recognized as reference types
311 Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (ValueType)), true, "#22");
312 Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (Enum)), true, "#23");
313 Assert.AreEqual (typeof (ValueType).IsAssignableFrom (typeof (Enum)), true, "#24");
315 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (ValueType[])), true, "#25");
316 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (ValueType[])), true, "#26");
317 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (ValueType[])), false, "#27");
319 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (Enum[])), true, "#28");
320 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (Enum[])), true, "#29");
321 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (Enum[])), true, "#30");
323 // Tests for byref types
324 MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
325 Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
326 Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
328 // Tests for type parameters
330 mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
331 Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
332 Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
337 [ExpectedException (typeof (ArgumentException))]
338 public void GetInterfaceMapOnInterface ()
340 typeof (IList).GetInterfaceMap (typeof (ICollection));
344 public void TestIsSubclassOf ()
346 Assert.IsTrue (typeof (ICloneable).IsSubclassOf (typeof (object)), "#01");
348 // Tests for byref types
349 Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
350 Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
351 //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
352 Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
356 public void TestGetMethodImpl ()
358 // Test binding of new slot methods (using no types)
359 Assert.AreEqual (typeof (Base), typeof (Base).GetMethod("TestVoid").DeclaringType, "#01");
360 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestVoid").DeclaringType, "#02");
362 // Test binding of new slot methods (using types)
363 Assert.AreEqual (typeof (Base), typeof (Base).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#03");
364 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#04");
366 // Test overload resolution
367 Assert.AreEqual (0, typeof (NewVTable).GetMethod ("Overload", new Type[0]).GetParameters ().Length, "#05");
369 // Test byref parameters
370 Assert.AreEqual (null, typeof (NewVTable).GetMethod ("byref_method", new Type[] { typeof (int) }), "#06");
371 Type byrefInt = typeof (NewVTable).GetMethod ("byref_method").GetParameters ()[0].ParameterType;
372 Assert.IsNotNull (typeof (NewVTable).GetMethod ("byref_method", new Type[] { byrefInt }), "#07");
376 [Category ("TargetJvmNotWorking")]
377 public void TestGetPropertyImpl ()
379 // Test getting property that is exact
380 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int32) }).DeclaringType, "#01");
382 // Test getting property that is not exact
383 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int16) }).DeclaringType, "#02");
385 // Test overriding of properties when only the set accessor is overriden
386 Assert.AreEqual (1, typeof (Derived1).GetProperties ().Length, "#03");
390 public void GetProperties ()
392 // Test hide-by-name-and-signature
393 Assert.AreEqual (1, typeof (Derived2).GetProperties ().Length);
394 Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetProperties ()[0].DeclaringType);
397 [Test] // GetProperties (BindingFlags)
398 public void GetProperties_Flags ()
400 PropertyInfo [] props;
401 Type type = typeof (Bar);
404 flags = BindingFlags.Instance | BindingFlags.NonPublic;
405 props = type.GetProperties (flags);
407 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#A1");
408 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#A2");
409 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#A3");
410 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#A4");
412 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#A5");
414 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#A5");
416 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#A6");
417 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#A7");
418 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#A8");
419 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#A9");
420 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#A10");
421 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#A11");
422 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#A12");
423 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#A13");
424 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#A14");
425 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#A15");
426 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#A16");
427 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#A17");
428 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#A18");
429 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#A19");
430 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#A20");
431 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#A21");
432 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#A22");
433 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#A23");
434 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#A24");
436 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#A25");
438 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#A25");
440 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#A26");
441 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#A27");
442 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#A28");
443 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#A29");
444 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#A30");
446 flags = BindingFlags.Instance | BindingFlags.Public;
447 props = type.GetProperties (flags);
449 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#B1");
450 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#B2");
451 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#B3");
452 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#B4");
453 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#B5");
454 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#B6");
455 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#B7");
456 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#B8");
457 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#B9");
458 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#B10");
459 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#B11");
460 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#B12");
461 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#B13");
462 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#B14");
463 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#B15");
464 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#B16");
465 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#B17");
466 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#B18");
467 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#B19");
468 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#B20");
469 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#B21");
470 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#B22");
471 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#B23");
472 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#B24");
473 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#B25");
474 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#B26");
475 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#B27");
476 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#B28");
477 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#B29");
478 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#B30");
480 flags = BindingFlags.Static | BindingFlags.Public;
481 props = type.GetProperties (flags);
483 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#C1");
484 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#C2");
485 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#C3");
486 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#C4");
487 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#C5");
488 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#C6");
489 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#C7");
490 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#C8");
491 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#C9");
492 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#C10");
493 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#C11");
494 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#C12");
495 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#C13");
496 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#C14");
497 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#C15");
498 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#C16");
499 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#C17");
500 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#C18");
501 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#C19");
502 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#C20");
503 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#C21");
504 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#C22");
505 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#C23");
506 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#C24");
507 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#C25");
508 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#C26");
509 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#C27");
510 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#C28");
511 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#C29");
512 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#C30");
514 flags = BindingFlags.Static | BindingFlags.NonPublic;
515 props = type.GetProperties (flags);
517 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#D1");
518 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#D2");
519 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#D3");
520 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#D4");
521 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#D5");
522 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#D6");
523 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#D7");
524 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#D8");
525 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#D9");
526 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#D10");
527 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#D11");
528 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#D12");
529 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#D13");
530 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#D14");
531 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#D15");
532 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#D16");
533 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#D17");
534 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#D18");
535 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#D19");
536 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#D20");
537 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#D21");
538 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#D22");
539 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#D23");
540 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#D24");
541 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#D25");
542 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#D26");
543 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#D27");
544 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#D28");
545 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#D29");
546 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#D30");
548 flags = BindingFlags.Instance | BindingFlags.NonPublic |
549 BindingFlags.FlattenHierarchy;
550 props = type.GetProperties (flags);
552 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#E1");
553 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#E2");
554 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#E3");
555 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#E4");
557 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#E5");
559 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#E5");
561 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#E6");
562 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#E7");
563 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#E8");
564 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#E9");
565 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#E10");
566 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#E11");
567 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#E12");
568 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#E13");
569 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#E14");
570 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#E15");
571 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#E16");
572 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#E17");
573 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#E18");
574 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#E19");
575 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#E20");
576 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#E21");
577 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#E22");
578 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#E23");
579 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#E24");
581 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#E25");
583 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#E25");
585 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#E26");
586 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#E27");
587 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#E28");
588 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#E29");
589 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#E30");
591 flags = BindingFlags.Instance | BindingFlags.Public |
592 BindingFlags.FlattenHierarchy;
593 props = type.GetProperties (flags);
595 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#F1");
596 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#F2");
597 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#F3");
598 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#F4");
599 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#F5");
600 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#F6");
601 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#F7");
602 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#F8");
603 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#F9");
604 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#F10");
605 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#F11");
606 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#F12");
607 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#F13");
608 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#F14");
609 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#F15");
610 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#F16");
611 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#F17");
612 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#F18");
613 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#F19");
614 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#F20");
615 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#F21");
616 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#F22");
617 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#F23");
618 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#F24");
619 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#F25");
620 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#F26");
621 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#F27");
622 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#F28");
623 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#F29");
624 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#F30");
626 flags = BindingFlags.Static | BindingFlags.Public |
627 BindingFlags.FlattenHierarchy;
628 props = type.GetProperties (flags);
630 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#G1");
631 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#G2");
632 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#G3");
633 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#G4");
634 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#G5");
635 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#G6");
636 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#G7");
637 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#G8");
638 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#G9");
639 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#G10");
640 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#G11");
641 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#G12");
642 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#G13");
643 Assert.IsTrue (ContainsProperty (props, "PubStatBase"), "#G14");
644 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#G15");
645 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#G16");
646 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#G17");
647 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#G18");
648 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#G19");
649 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#G20");
650 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#G21");
651 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#G22");
652 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#G23");
653 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#G24");
654 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#G25");
655 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#G26");
656 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#G27");
657 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#G28");
658 Assert.IsTrue (ContainsProperty (props, "PubStatBlue"), "#G29");
659 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#G30");
661 flags = BindingFlags.Static | BindingFlags.NonPublic |
662 BindingFlags.FlattenHierarchy;
663 props = type.GetProperties (flags);
665 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#H1");
666 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#H2");
667 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#H3");
668 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#H4");
669 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#H5");
670 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#H6");
671 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#H7");
672 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#H8");
673 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#H9");
674 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#H10");
675 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#H11");
676 Assert.IsTrue (ContainsProperty (props, "ProtStatBase"), "#H12");
677 Assert.IsTrue (ContainsProperty (props, "ProIntStatBase"), "#H13");
678 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#H14");
680 Assert.IsTrue (ContainsProperty (props, "IntStatBase"), "#H15");
682 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#H15");
684 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#H16");
685 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#H17");
686 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#H18");
687 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#H19");
688 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#H20");
689 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#H21");
690 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#H22");
691 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#H23");
692 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#H24");
693 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#H25");
694 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#H26");
695 Assert.IsTrue (ContainsProperty (props, "ProtStatBlue"), "#H27");
696 Assert.IsTrue (ContainsProperty (props, "ProIntStatBlue"), "#H28");
697 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#H29");
699 Assert.IsTrue (ContainsProperty (props, "IntStatBlue"), "#H30");
701 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#H50");
704 flags = BindingFlags.Instance | BindingFlags.NonPublic |
705 BindingFlags.DeclaredOnly;
706 props = type.GetProperties (flags);
708 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#I1");
709 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#I2");
710 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#I3");
711 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#I4");
712 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#I5");
713 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#I6");
714 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#I7");
715 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#I8");
716 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#I9");
717 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#I10");
718 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#I11");
719 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#I12");
720 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#I13");
721 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#I14");
722 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#I15");
723 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#I16");
724 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#I17");
725 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#I18");
726 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#I19");
727 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#I20");
728 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#I21");
729 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#I22");
730 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#I23");
731 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#I24");
732 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#I25");
733 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#I26");
734 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#I27");
735 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#I28");
736 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#I29");
737 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#I30");
739 flags = BindingFlags.Instance | BindingFlags.Public |
740 BindingFlags.DeclaredOnly;
741 props = type.GetProperties (flags);
743 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#J1");
744 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#J2");
745 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#J3");
746 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#J4");
747 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#J5");
748 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#J6");
749 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#J7");
750 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#J8");
751 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#J9");
752 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#J10");
753 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#J11");
754 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#J12");
755 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#J13");
756 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#J14");
757 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#J15");
758 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#J16");
759 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#J17");
760 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#J18");
761 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#J19");
762 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#J20");
763 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#J21");
764 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#J22");
765 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#J23");
766 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#J24");
767 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#J25");
768 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#J26");
769 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#J27");
770 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#J28");
771 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#J29");
772 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#J30");
774 flags = BindingFlags.Static | BindingFlags.Public |
775 BindingFlags.DeclaredOnly;
776 props = type.GetProperties (flags);
778 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#K1");
779 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#K2");
780 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#K3");
781 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#K4");
782 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#K5");
783 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#K6");
784 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#K7");
785 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#K8");
786 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#K9");
787 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#K10");
788 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#K11");
789 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#K12");
790 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#K13");
791 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#K14");
792 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#K15");
793 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#K16");
794 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#K17");
795 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#K18");
796 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#K19");
797 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#K20");
798 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#K21");
799 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#K22");
800 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#K23");
801 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#K24");
802 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#K25");
803 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#K26");
804 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#K27");
805 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#K28");
806 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#K29");
807 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#K30");
809 flags = BindingFlags.Static | BindingFlags.NonPublic |
810 BindingFlags.DeclaredOnly;
811 props = type.GetProperties (flags);
813 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#L1");
814 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#L2");
815 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#L3");
816 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#L4");
817 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#L5");
818 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#L6");
819 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#L7");
820 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#L8");
821 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#L9");
822 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#L10");
823 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#L11");
824 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#L12");
825 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#L13");
826 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#L14");
827 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#L15");
828 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#L16");
829 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#L17");
830 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#L18");
831 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#L19");
832 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#L20");
833 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#L21");
834 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#L22");
835 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#L23");
836 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#L24");
837 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#L25");
838 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#L26");
839 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#L27");
840 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#L28");
841 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#L29");
842 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#L30");
844 flags = BindingFlags.Instance | BindingFlags.NonPublic |
846 props = type.GetProperties (flags);
848 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#M1");
849 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#M2");
850 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#M3");
851 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#M4");
853 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#M5");
855 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#M5");
857 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#M6");
858 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#M7");
859 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#M8");
860 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#M9");
861 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#M10");
862 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#M11");
863 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#M12");
864 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#M13");
865 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#M14");
866 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#M15");
867 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#M16");
868 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#M17");
869 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#M18");
870 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#M19");
871 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#M20");
872 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#M21");
873 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#M22");
874 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#M23");
875 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#M24");
877 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#M25");
879 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#M25");
881 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#M26");
882 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#M27");
883 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#M28");
884 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#M29");
885 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#M30");
887 flags = BindingFlags.Static | BindingFlags.NonPublic |
889 props = type.GetProperties (flags);
891 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#N1");
892 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#N2");
893 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#N3");
894 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#N4");
895 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#N5");
896 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#N6");
897 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#N7");
898 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#N8");
899 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#N9");
900 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#N10");
901 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#N11");
902 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#N12");
903 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#N13");
904 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#N14");
905 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#N15");
906 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#N16");
907 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#N17");
908 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#N18");
909 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#N19");
910 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#N20");
911 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#N21");
912 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#N22");
913 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#N23");
914 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#N24");
915 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#N25");
916 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#N26");
917 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#N27");
918 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#N28");
919 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#N29");
920 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#N30");
923 [Test] // GetProperty (String)
924 public void GetProperty1_Name_Null ()
926 Type type = typeof (Bar);
928 type.GetProperty ((string) null);
930 } catch (ArgumentNullException ex) {
931 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
932 Assert.IsNull (ex.InnerException, "#3");
933 Assert.IsNotNull (ex.Message, "#4");
934 Assert.IsNotNull (ex.ParamName, "#5");
935 Assert.AreEqual ("name", ex.ParamName, "#6");
939 [Test] // GetProperty (String, BindingFlags)
940 public void GetProperty2 ()
942 Type type = typeof (Bar);
945 flags = BindingFlags.Instance | BindingFlags.NonPublic;
947 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#A1");
948 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#A2");
949 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#A3");
950 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#A4");
952 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#A5");
954 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#A5");
956 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#A6");
957 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#A7");
958 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#A8");
959 Assert.IsNull (type.GetProperty ("PubInst", flags), "#A9");
960 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#A10");
961 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#A11");
962 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#A12");
963 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#A13");
964 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#A14");
965 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#A15");
966 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#A16");
967 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#A17");
968 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#A18");
969 Assert.IsNull (type.GetProperty ("PubStat", flags), "#A19");
970 Assert.IsNull (type.GetProperty ("IntStat", flags), "#A20");
971 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#A21");
972 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#A22");
973 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#A23");
974 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#A24");
976 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#A25");
978 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#A25");
980 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#A26");
981 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#A27");
982 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#A28");
983 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#A29");
984 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#A30");
986 flags = BindingFlags.Instance | BindingFlags.Public;
988 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#B1");
989 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#B2");
990 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#B3");
991 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#B4");
992 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#B5");
993 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#B6");
994 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#B7");
995 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#B8");
996 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#B9");
997 Assert.IsNull (type.GetProperty ("IntInst", flags), "#B10");
998 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#B11");
999 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#B12");
1000 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#B13");
1001 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#B14");
1002 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#B15");
1003 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#B16");
1004 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#B17");
1005 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#B18");
1006 Assert.IsNull (type.GetProperty ("PubStat", flags), "#B19");
1007 Assert.IsNull (type.GetProperty ("IntStat", flags), "#B20");
1008 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#B21");
1009 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#B22");
1010 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#B23");
1011 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#B24");
1012 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#B25");
1013 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#B26");
1014 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#B27");
1015 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#B28");
1016 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#B29");
1017 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#B30");
1019 flags = BindingFlags.Static | BindingFlags.Public;
1021 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#C1");
1022 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#C2");
1023 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#C3");
1024 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#C4");
1025 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#C5");
1026 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#C6");
1027 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#C7");
1028 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#C8");
1029 Assert.IsNull (type.GetProperty ("PubInst", flags), "#C9");
1030 Assert.IsNull (type.GetProperty ("IntInst", flags), "#C10");
1031 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#C11");
1032 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#C12");
1033 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#C13");
1034 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#C14");
1035 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#C15");
1036 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#C16");
1037 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#C17");
1038 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#C18");
1039 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#C19");
1040 Assert.IsNull (type.GetProperty ("IntStat", flags), "#C20");
1041 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#C21");
1042 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#C22");
1043 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#C23");
1044 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#C24");
1045 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#C25");
1046 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#C26");
1047 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#C27");
1048 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#C28");
1049 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#C29");
1050 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#C30");
1052 flags = BindingFlags.Static | BindingFlags.NonPublic;
1054 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#D1");
1055 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#D2");
1056 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#D3");
1057 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#D4");
1058 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#D5");
1059 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#D6");
1060 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#D7");
1061 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#D8");
1062 Assert.IsNull (type.GetProperty ("PubInst", flags), "#D9");
1063 Assert.IsNull (type.GetProperty ("IntInst", flags), "#D10");
1064 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#D11");
1065 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#D12");
1066 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#D13");
1067 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#D14");
1068 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#D15");
1069 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#D16");
1070 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#D17");
1071 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#D18");
1072 Assert.IsNull (type.GetProperty ("PubStat", flags), "#D19");
1073 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#D20");
1074 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#D21");
1075 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#D22");
1076 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#D23");
1077 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#D24");
1078 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#D25");
1079 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#D26");
1080 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#D27");
1081 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#D28");
1082 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#D29");
1083 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#D30");
1085 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1086 BindingFlags.FlattenHierarchy;
1088 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#E1");
1089 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#E2");
1090 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#E3");
1091 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#E4");
1093 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#E5");
1095 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#E5");
1097 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#E6");
1098 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#E7");
1099 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#E8");
1100 Assert.IsNull (type.GetProperty ("PubInst", flags), "#E9");
1101 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#E10");
1102 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#E11");
1103 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#E12");
1104 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#E13");
1105 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#E14");
1106 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#E15");
1107 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#E16");
1108 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#E17");
1109 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#E18");
1110 Assert.IsNull (type.GetProperty ("PubStat", flags), "#E19");
1111 Assert.IsNull (type.GetProperty ("IntStat", flags), "#E20");
1112 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#E21");
1113 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#E22");
1114 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#E23");
1115 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#E24");
1117 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1119 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1121 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#E26");
1122 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#E27");
1123 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#E28");
1124 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#E29");
1125 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#E30");
1127 flags = BindingFlags.Instance | BindingFlags.Public |
1128 BindingFlags.FlattenHierarchy;
1130 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#F1");
1131 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#F2");
1132 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#F3");
1133 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#F4");
1134 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#F5");
1135 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#F6");
1136 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#F7");
1137 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#F8");
1138 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#F9");
1139 Assert.IsNull (type.GetProperty ("IntInst", flags), "#F10");
1140 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#F11");
1141 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#F12");
1142 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#F13");
1143 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#F14");
1144 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#F15");
1145 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#F16");
1146 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#F17");
1147 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#F18");
1148 Assert.IsNull (type.GetProperty ("PubStat", flags), "#F19");
1149 Assert.IsNull (type.GetProperty ("IntStat", flags), "#F20");
1150 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#F21");
1151 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#F22");
1152 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#F23");
1153 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#F24");
1154 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#F25");
1155 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#F26");
1156 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#F27");
1157 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#F28");
1158 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#F29");
1159 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#F30");
1161 flags = BindingFlags.Static | BindingFlags.Public |
1162 BindingFlags.FlattenHierarchy;
1164 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#G1");
1165 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#G2");
1166 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#G3");
1167 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#G4");
1168 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#G5");
1169 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#G6");
1170 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#G7");
1171 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#G8");
1172 Assert.IsNull (type.GetProperty ("PubInst", flags), "#G9");
1173 Assert.IsNull (type.GetProperty ("IntInst", flags), "#G10");
1174 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#G11");
1175 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#G12");
1176 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#G13");
1177 Assert.IsNotNull (type.GetProperty ("PubStatBase", flags), "#G14");
1178 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#G15");
1179 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#G16");
1180 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#G17");
1181 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#G18");
1182 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#G19");
1183 Assert.IsNull (type.GetProperty ("IntStat", flags), "#G20");
1184 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#G21");
1185 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#G22");
1186 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#G23");
1187 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#G24");
1188 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#G25");
1189 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#G26");
1190 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#G27");
1191 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#G28");
1192 Assert.IsNotNull (type.GetProperty ("PubStatBlue", flags), "#G29");
1193 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#G30");
1195 flags = BindingFlags.Static | BindingFlags.NonPublic |
1196 BindingFlags.FlattenHierarchy;
1198 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#H1");
1199 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#H2");
1200 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#H3");
1201 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#H4");
1202 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#H5");
1203 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#H6");
1204 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#H7");
1205 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#H8");
1206 Assert.IsNull (type.GetProperty ("PubInst", flags), "#H9");
1207 Assert.IsNull (type.GetProperty ("IntInst", flags), "#H10");
1208 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#H11");
1209 Assert.IsNotNull (type.GetProperty ("ProtStatBase", flags), "#H12");
1210 Assert.IsNotNull (type.GetProperty ("ProIntStatBase", flags), "#H13");
1211 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#H14");
1213 Assert.IsNotNull (type.GetProperty ("IntStatBase", flags), "#H15");
1215 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#H15");
1217 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#H16");
1218 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#H17");
1219 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#H18");
1220 Assert.IsNull (type.GetProperty ("PubStat", flags), "#H19");
1221 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#H20");
1222 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#H21");
1223 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#H22");
1224 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#H23");
1225 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#H24");
1226 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#H25");
1227 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#H26");
1228 Assert.IsNotNull (type.GetProperty ("ProtStatBlue", flags), "#H27");
1229 Assert.IsNotNull (type.GetProperty ("ProIntStatBlue", flags), "#H28");
1230 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#H29");
1232 Assert.IsNotNull (type.GetProperty ("IntStatBlue", flags), "#H30");
1234 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#H60");
1237 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1238 BindingFlags.DeclaredOnly;
1240 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#I1");
1241 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#I2");
1242 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#I3");
1243 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#I4");
1244 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#I5");
1245 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#I6");
1246 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#I7");
1247 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#I8");
1248 Assert.IsNull (type.GetProperty ("PubInst", flags), "#I9");
1249 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#I10");
1250 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#I11");
1251 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#I12");
1252 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#I13");
1253 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#I14");
1254 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#I15");
1255 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#I16");
1256 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#I17");
1257 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#I18");
1258 Assert.IsNull (type.GetProperty ("PubStat", flags), "#I19");
1259 Assert.IsNull (type.GetProperty ("IntStat", flags), "#I20");
1260 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#I21");
1261 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#I22");
1262 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#I23");
1263 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#I24");
1264 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#I25");
1265 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#I26");
1266 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#I27");
1267 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#I28");
1268 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#I29");
1269 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#I30");
1271 flags = BindingFlags.Instance | BindingFlags.Public |
1272 BindingFlags.DeclaredOnly;
1274 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#J1");
1275 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#J2");
1276 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#J3");
1277 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#J4");
1278 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#J5");
1279 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#J6");
1280 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#J7");
1281 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#J8");
1282 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#J9");
1283 Assert.IsNull (type.GetProperty ("IntInst", flags), "#J10");
1284 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#J11");
1285 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#J12");
1286 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#J13");
1287 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#J14");
1288 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#J15");
1289 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#J16");
1290 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#J17");
1291 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#J18");
1292 Assert.IsNull (type.GetProperty ("PubStat", flags), "#J19");
1293 Assert.IsNull (type.GetProperty ("IntStat", flags), "#J20");
1294 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#J21");
1295 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#J22");
1296 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#J23");
1297 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#J24");
1298 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#J25");
1299 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#J26");
1300 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#J27");
1301 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#J28");
1302 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#J29");
1303 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#J30");
1305 flags = BindingFlags.Static | BindingFlags.Public |
1306 BindingFlags.DeclaredOnly;
1308 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#K1");
1309 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#K2");
1310 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#K3");
1311 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#K4");
1312 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#K5");
1313 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#K6");
1314 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#K7");
1315 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#K8");
1316 Assert.IsNull (type.GetProperty ("PubInst", flags), "#K9");
1317 Assert.IsNull (type.GetProperty ("IntInst", flags), "#K10");
1318 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#K11");
1319 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#K12");
1320 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#K13");
1321 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#K14");
1322 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#K15");
1323 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#K16");
1324 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#K17");
1325 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#K18");
1326 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#K19");
1327 Assert.IsNull (type.GetProperty ("IntStat", flags), "#K20");
1328 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#K21");
1329 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#K22");
1330 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#K23");
1331 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#K24");
1332 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#K25");
1333 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#K26");
1334 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#K27");
1335 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#K28");
1336 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#K29");
1337 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#K30");
1339 flags = BindingFlags.Static | BindingFlags.NonPublic |
1340 BindingFlags.DeclaredOnly;
1342 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#L1");
1343 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#L2");
1344 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#L3");
1345 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#L4");
1346 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#L5");
1347 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#L6");
1348 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#L7");
1349 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#L8");
1350 Assert.IsNull (type.GetProperty ("PubInst", flags), "#L9");
1351 Assert.IsNull (type.GetProperty ("IntInst", flags), "#L10");
1352 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#L11");
1353 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#L12");
1354 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#L13");
1355 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#L14");
1356 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#L15");
1357 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#L16");
1358 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#L17");
1359 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#L18");
1360 Assert.IsNull (type.GetProperty ("PubStat", flags), "#L19");
1361 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#L20");
1362 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#L21");
1363 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#L22");
1364 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#L23");
1365 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#L24");
1366 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#L25");
1367 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#L26");
1368 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#L27");
1369 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#L28");
1370 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#L29");
1371 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#L30");
1373 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1374 BindingFlags.Public;
1376 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#M1");
1377 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#M2");
1378 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#M3");
1379 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#M4");
1381 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#M5");
1383 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#M5");
1385 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#M6");
1386 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#M7");
1387 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#M8");
1388 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#M9");
1389 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#M10");
1390 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#M11");
1391 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#M12");
1392 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#M13");
1393 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#M14");
1394 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#M15");
1395 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#M16");
1396 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#M17");
1397 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#M18");
1398 Assert.IsNull (type.GetProperty ("PubStat", flags), "#M19");
1399 Assert.IsNull (type.GetProperty ("IntStat", flags), "#M20");
1400 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#M21");
1401 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#M22");
1402 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#M23");
1403 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#M24");
1405 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1407 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1409 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#M26");
1410 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#M27");
1411 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#M28");
1412 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#M29");
1413 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#M30");
1415 flags = BindingFlags.Static | BindingFlags.NonPublic |
1416 BindingFlags.Public;
1418 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#N1");
1419 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#N2");
1420 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#N3");
1421 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#N4");
1422 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#N5");
1423 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#N6");
1424 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#N7");
1425 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#N8");
1426 Assert.IsNull (type.GetProperty ("PubInst", flags), "#N9");
1427 Assert.IsNull (type.GetProperty ("IntInst", flags), "#N10");
1428 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#N11");
1429 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#N12");
1430 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#N13");
1431 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#N14");
1432 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#N15");
1433 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#N16");
1434 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#N17");
1435 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#N18");
1436 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#N19");
1437 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#N20");
1438 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#N21");
1439 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#N22");
1440 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#N23");
1441 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#N24");
1442 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#N25");
1443 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#N26");
1444 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#N27");
1445 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#N28");
1446 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#N29");
1447 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#N30");
1450 [Test] // GetProperty (String, BindingFlags)
1451 public void GetProperty2_Name_Null ()
1453 Type type = typeof (Bar);
1455 type.GetProperty ((string) null);
1457 } catch (ArgumentNullException ex) {
1458 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1459 Assert.IsNull (ex.InnerException, "#3");
1460 Assert.IsNotNull (ex.Message, "#4");
1461 Assert.IsNotNull (ex.ParamName, "#5");
1462 Assert.AreEqual ("name", ex.ParamName, "#6");
1466 [Test] // GetProperty (String, Type)
1467 public void GetProperty3_Name_Null ()
1469 Type type = typeof (Bar);
1471 type.GetProperty ((string) null, typeof (int));
1473 } catch (ArgumentNullException ex) {
1474 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1475 Assert.IsNull (ex.InnerException, "#3");
1476 Assert.IsNotNull (ex.Message, "#4");
1477 Assert.IsNotNull (ex.ParamName, "#5");
1478 Assert.AreEqual ("name", ex.ParamName, "#6");
1482 [Test] // GetProperty (String, Type [])
1483 public void GetProperty4_Name_Null ()
1485 Type type = typeof (Bar);
1487 type.GetProperty ((string) null, Type.EmptyTypes);
1489 } catch (ArgumentNullException ex) {
1490 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1491 Assert.IsNull (ex.InnerException, "#3");
1492 Assert.IsNotNull (ex.Message, "#4");
1493 Assert.IsNotNull (ex.ParamName, "#5");
1494 Assert.AreEqual ("name", ex.ParamName, "#6");
1498 [Test] // GetProperty (String, Type, Type [])
1499 public void GetProperty5_Name_Null ()
1501 Type type = typeof (Bar);
1503 type.GetProperty ((string) null, typeof (int),
1506 } catch (ArgumentNullException ex) {
1507 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1508 Assert.IsNull (ex.InnerException, "#3");
1509 Assert.IsNotNull (ex.Message, "#4");
1510 Assert.IsNotNull (ex.ParamName, "#5");
1511 Assert.AreEqual ("name", ex.ParamName, "#6");
1515 [Test] // GetProperty (String, Type, Type [], ParameterModifier [])
1516 public void GetProperty6_Name_Null ()
1518 Type type = typeof (Bar);
1520 type.GetProperty ((string) null, typeof (int),
1521 Type.EmptyTypes, null);
1523 } catch (ArgumentNullException ex) {
1524 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1525 Assert.IsNull (ex.InnerException, "#3");
1526 Assert.IsNotNull (ex.Message, "#4");
1527 Assert.IsNotNull (ex.ParamName, "#5");
1528 Assert.AreEqual ("name", ex.ParamName, "#6");
1532 [Test] // GetProperty (String, BindingFlags, Binder, Type, Type [], ParameterModifier [])
1533 public void GetProperty7_Name_Null ()
1535 Type type = typeof (Bar);
1537 type.GetProperty ((string) null, BindingFlags.Public,
1538 null, typeof (int), Type.EmptyTypes, null);
1540 } catch (ArgumentNullException ex) {
1541 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1542 Assert.IsNull (ex.InnerException, "#3");
1543 Assert.IsNotNull (ex.Message, "#4");
1544 Assert.IsNotNull (ex.ParamName, "#5");
1545 Assert.AreEqual ("name", ex.ParamName, "#6");
1550 public void GetProperty8_PropertyType ()
1552 Type type = typeof (Bar);
1553 Assert.IsNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance,
1554 null, typeof (int), Type.EmptyTypes, null), "#1");
1555 Assert.IsNotNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance, null,
1556 typeof (long), new Type[0], null), "#2");
1559 #if !TARGET_JVM // StructLayout not supported for TARGET_JVM
1560 [StructLayout(LayoutKind.Explicit, Pack = 4, Size = 64)]
1565 [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
1572 public void StructLayoutAttribute ()
1574 StructLayoutAttribute attr1 = typeof (TypeTest).StructLayoutAttribute;
1575 Assert.AreEqual (LayoutKind.Auto, attr1.Value);
1577 StructLayoutAttribute attr2 = typeof (Class1).StructLayoutAttribute;
1578 Assert.AreEqual (LayoutKind.Explicit, attr2.Value);
1579 Assert.AreEqual (4, attr2.Pack);
1580 Assert.AreEqual (64, attr2.Size);
1582 StructLayoutAttribute attr3 = typeof (Class2).StructLayoutAttribute;
1583 Assert.AreEqual (LayoutKind.Explicit, attr3.Value);
1584 Assert.AreEqual (CharSet.Unicode, attr3.CharSet);
1587 #endif // TARGET_JVM
1590 public void Namespace ()
1592 Assert.AreEqual (null, typeof (NoNamespaceClass).Namespace);
1595 public static void Reflected (ref int a)
1602 Assert.AreEqual ("Int32&", typeof (TypeTest).GetMethod ("Reflected").GetParameters () [0].ParameterType.Name);
1603 Assert.AreEqual ("String[*]", Array.CreateInstance (typeof(string), new int[] { 1 }, new int[] { 1 }).GetType ().Name);
1607 public void GetInterfaces ()
1609 Type[] t = typeof (Duper).GetInterfaces ();
1610 Assert.AreEqual (1, t.Length);
1611 Assert.AreEqual (typeof (ICloneable), t[0]);
1613 Type[] t2 = typeof (IFace3).GetInterfaces ();
1614 Assert.AreEqual (2, t2.Length);
1620 public void GetFieldIgnoreCase ()
1622 Assert.IsNotNull (typeof (TypeTest).GetField ("afield", BindingFlags.Instance|BindingFlags.Public|BindingFlags.IgnoreCase));
1636 public void GetPropertyAccessorModifiers ()
1638 Assert.IsNotNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.Public));
1639 Assert.IsNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.NonPublic));
1644 public void IsAbstract ()
1646 Assert.IsFalse (typeof (string).IsAbstract, "#1");
1647 Assert.IsTrue (typeof (ICloneable).IsAbstract, "#2");
1648 Assert.IsTrue (typeof (ValueType).IsAbstract, "#3");
1649 Assert.IsTrue (typeof (Enum).IsAbstract, "#4");
1650 Assert.IsFalse (typeof (TimeSpan).IsAbstract, "#5");
1651 Assert.IsTrue (typeof (TextReader).IsAbstract, "#6");
1655 // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=286308
1656 Type [] typeArgs = typeof (List<>).GetGenericArguments ();
1657 Assert.IsFalse (typeArgs [0].IsAbstract, "#7");
1662 public void IsCOMObject ()
1664 Type type = typeof (string);
1665 Assert.IsFalse (type.IsCOMObject, "#1");
1667 TypeBuilder tb = module.DefineType (genTypeName ());
1668 type = tb.CreateType ();
1669 Assert.IsFalse (type.IsCOMObject, "#2");
1673 public void IsImport ()
1675 Type type = typeof (string);
1676 Assert.IsFalse (type.IsImport, "#1");
1678 TypeBuilder tb = module.DefineType (genTypeName ());
1679 type = tb.CreateType ();
1680 Assert.IsFalse (type.IsImport, "#2");
1682 tb = module.DefineType (genTypeName (), TypeAttributes.Import |
1683 TypeAttributes.Interface | TypeAttributes.Abstract);
1684 type = tb.CreateType ();
1685 Assert.IsTrue (type.IsImport, "#3");
1689 public void IsInterface ()
1691 Assert.IsFalse (typeof (string).IsInterface, "#1");
1692 Assert.IsTrue (typeof (ICloneable).IsInterface, "#2");
1696 public void IsPrimitive () {
1697 Assert.IsTrue (typeof (IntPtr).IsPrimitive, "#1");
1698 Assert.IsTrue (typeof (int).IsPrimitive, "#2");
1699 Assert.IsFalse (typeof (string).IsPrimitive, "#2");
1703 public void IsValueType ()
1705 Assert.IsTrue (typeof (int).IsValueType, "#1");
1706 Assert.IsFalse (typeof (Enum).IsValueType, "#2");
1707 Assert.IsFalse (typeof (ValueType).IsValueType, "#3");
1708 Assert.IsTrue (typeof (AttributeTargets).IsValueType, "#4");
1709 Assert.IsFalse (typeof (string).IsValueType, "#5");
1710 Assert.IsTrue (typeof (TimeSpan).IsValueType, "#6");
1714 [Category("NotDotNet")]
1715 // Depends on the GAC working, which it doesn't durring make distcheck.
1716 [Category ("NotWorking")]
1717 public void GetTypeWithWhitespace ()
1719 Assert.IsNotNull (Type.GetType
1720 (@"System.Configuration.NameValueSectionHandler,
1725 PublicKeyToken=b77a5c561934e089"));
1729 public void GetTypeNonVectorArray ()
1731 Type t = Type.GetType ("System.String[*]");
1732 Assert.AreEqual ("System.String[*]", t.ToString ());
1736 public void ExerciseFilterName ()
1738 MemberInfo[] mi = typeof(Base).FindMembers(
1740 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1741 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1742 Type.FilterName, "*");
1743 Assert.AreEqual (4, mi.Length);
1744 mi = typeof(Base).FindMembers(
1746 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1747 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1748 Type.FilterName, "Test*");
1749 Assert.AreEqual (2, mi.Length);
1750 mi = typeof(Base).FindMembers(
1752 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1753 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1754 Type.FilterName, "TestVoid");
1755 Assert.AreEqual (1, mi.Length);
1756 mi = typeof(Base).FindMembers(
1758 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1759 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1760 Type.FilterName, "NonExistingMethod");
1761 Assert.AreEqual (0, mi.Length);
1765 public void ExerciseFilterNameIgnoreCase ()
1767 MemberInfo[] mi = typeof(Base).FindMembers(
1769 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1770 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1771 Type.FilterNameIgnoreCase, "*");
1772 Assert.AreEqual (4, mi.Length);
1773 mi = typeof(Base).FindMembers(
1775 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1776 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1777 Type.FilterNameIgnoreCase, "test*");
1778 Assert.AreEqual (2, mi.Length);
1779 mi = typeof(Base).FindMembers(
1781 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1782 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1783 Type.FilterNameIgnoreCase, "TESTVOID");
1784 Assert.AreEqual (1, mi.Length);
1785 mi = typeof(Base).FindMembers(
1787 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1788 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1789 Type.FilterNameIgnoreCase, "NonExistingMethod");
1790 Assert.AreEqual (0, mi.Length);
1796 public int property {
1799 public ByRef0 (int i) {}
1800 public void f (int i) {}
1804 public void ByrefTypes ()
1806 Type t = Type.GetType ("MonoTests.System.TypeTest+ByRef0&");
1807 Assert.IsNotNull (t);
1808 Assert.IsTrue (t.IsByRef);
1809 Assert.AreEqual (0, t.GetMethods (BindingFlags.Public | BindingFlags.Instance).Length);
1810 Assert.AreEqual (0, t.GetConstructors (BindingFlags.Public | BindingFlags.Instance).Length);
1811 Assert.AreEqual (0, t.GetEvents (BindingFlags.Public | BindingFlags.Instance).Length);
1812 Assert.AreEqual (0, t.GetProperties (BindingFlags.Public | BindingFlags.Instance).Length);
1814 Assert.IsNull (t.GetMethod ("f"));
1815 Assert.IsNull (t.GetField ("field"));
1816 Assert.IsNull (t.GetProperty ("property"));
1820 public void TestAssemblyQualifiedName ()
1822 Type t = Type.GetType ("System.Byte[]&");
1823 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte[]&"));
1825 t = Type.GetType ("System.Byte*&");
1826 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte*&"));
1828 t = Type.GetType ("System.Byte&");
1829 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte&"));
1838 public void CreateValueTypeNoCtor ()
1840 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, null);
1844 [ExpectedException (typeof (MissingMethodException))]
1845 public void CreateValueTypeNoCtorArgs ()
1847 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, new object [] { 1 });
1850 internal static string bug336841 (string param1, params string [] param2)
1852 StringBuilder sb = new StringBuilder ();
1856 for (int i = 0; i < param2.Length; i++) {
1859 sb.Append (param2 [i]);
1861 return sb.ToString ();
1864 internal static string bug336841 (string param1)
1866 return "#B:" + param1;
1869 internal static string bug336841 (params string [] param1)
1871 StringBuilder sb = new StringBuilder ();
1873 for (int i = 0; i < param1.Length; i++) {
1876 sb.Append (param1 [i]);
1878 return sb.ToString ();
1882 public void InvokeMember_GetSetField ()
1884 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1885 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1886 BindingFlags.SetField, null, null, new object [] { 5 });
1888 Assert.AreEqual (5, X.Value, "#A1");
1889 Assert.AreEqual (5, typeof (X).InvokeMember ("Value",
1890 BindingFlags.Public | BindingFlags.Static |
1891 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1892 null, null, new object [0]), "#A2");
1893 Assert.AreEqual (5, Y.Value, "#A3");
1894 Assert.AreEqual (5, typeof (Y).InvokeMember ("Value",
1895 BindingFlags.Public | BindingFlags.Static |
1896 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1897 null, null, new object [0]), "#A4");
1900 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1901 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1902 BindingFlags.GetField | BindingFlags.SetField,
1903 null, null, new object [] { 5 });
1904 Assert.Fail ("#B1");
1905 } catch (ArgumentException ex) {
1906 // Cannot specify both Get and Set on a field
1907 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1908 Assert.IsNull (ex.InnerException, "#B3");
1909 Assert.IsNotNull (ex.Message, "#B4");
1910 Assert.IsNotNull (ex.ParamName, "#B5");
1912 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1914 Assert.AreEqual ("invokeAttr", ex.ParamName, "#B6");
1920 public void InvokeMember_GetSetProperty ()
1923 typeof (ArrayList).InvokeMember ("Item",
1924 BindingFlags.GetProperty | BindingFlags.SetProperty |
1925 BindingFlags.Instance | BindingFlags.Public,
1926 null, new ArrayList (), new object [] { 0, "bar" });
1928 } catch (ArgumentException ex) {
1929 // Cannot specify both Get and Set on a property
1930 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1931 Assert.IsNull (ex.InnerException, "#3");
1932 Assert.IsNotNull (ex.Message, "#4");
1933 Assert.IsNotNull (ex.ParamName, "#5");
1935 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1937 Assert.AreEqual ("invokeAttr", ex.ParamName, "#6");
1944 public void InvokeMember_InvokeMethod_Set ()
1947 typeof (ArrayList).InvokeMember ("ToString",
1948 BindingFlags.InvokeMethod | BindingFlags.SetField |
1949 BindingFlags.Instance | BindingFlags.Public,
1950 null, new ArrayList (), new object [0]);
1951 Assert.Fail ("#A1");
1952 } catch (ArgumentException ex) {
1953 // Cannot specify Set on a field and Invoke on a method
1954 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1955 Assert.IsNull (ex.InnerException, "#A3");
1956 Assert.IsNotNull (ex.Message, "#A4");
1957 Assert.IsNotNull (ex.ParamName, "#A5");
1959 Assert.AreEqual ("bindingFlags", ex.ParamName, "#A6");
1961 Assert.AreEqual ("invokeAttr", ex.ParamName, "#A6");
1966 typeof (ArrayList).InvokeMember ("ToString",
1967 BindingFlags.InvokeMethod | BindingFlags.SetProperty |
1968 BindingFlags.Instance | BindingFlags.Public,
1969 null, new ArrayList (), new object [0]);
1970 Assert.Fail ("#B1");
1971 } catch (ArgumentException ex) {
1972 // Cannot specify Set on a property and Invoke on a method
1973 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1974 Assert.IsNull (ex.InnerException, "#B3");
1975 Assert.IsNotNull (ex.Message, "#B4");
1976 Assert.IsNotNull (ex.ParamName, "#B5");
1978 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1980 Assert.AreEqual ("invokeAttr", ex.ParamName, "#B6");
1986 public void InvokeMember_MatchPrimitiveTypeWithInterface ()
1988 object [] invokeargs = { 1 };
1989 typeof (Z).InvokeMember ("", BindingFlags.DeclaredOnly |
1990 BindingFlags.Public | BindingFlags.NonPublic |
1991 BindingFlags.Instance | BindingFlags.CreateInstance,
1992 null, null, invokeargs);
1996 public void InvokeMember_Name_Null ()
1999 typeof (X).InvokeMember ((string) null,
2000 BindingFlags.Public | BindingFlags.Static |
2001 BindingFlags.FlattenHierarchy | BindingFlags.SetField,
2002 null, null, new object [] { 5 });
2004 } catch (ArgumentNullException ex) {
2005 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2006 Assert.IsNull (ex.InnerException, "#3");
2007 Assert.IsNotNull (ex.Message, "#4");
2008 Assert.IsNotNull (ex.ParamName, "#5");
2009 Assert.AreEqual ("name", ex.ParamName, "#6");
2014 public void InvokeMember_NoOperation ()
2017 typeof (TypeTest).InvokeMember ("Run", BindingFlags.Public |
2018 BindingFlags.Static, null, null, new object [0]);
2020 } catch (ArgumentException ex) {
2021 // Must specify binding flags describing the
2022 // invoke operation required
2023 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2024 Assert.IsNull (ex.InnerException, "#3");
2025 Assert.IsNotNull (ex.Message, "#4");
2026 Assert.IsNotNull (ex.ParamName, "#5");
2028 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2030 Assert.AreEqual ("invokeAttr", ex.ParamName, "#6");
2035 [Test] // bug #321735
2036 public void InvokeMember_SetFieldProperty ()
2038 ArrayList list = new ArrayList ();
2040 list.GetType ().InvokeMember ("Item",
2041 BindingFlags.SetField | BindingFlags.SetProperty |
2042 BindingFlags.Instance | BindingFlags.Public,
2043 null, list, new object [] { 0, "bar" });
2044 Assert.AreEqual ("bar", list [0]);
2048 public void InvokeMember_SetField_ProvidedArgs ()
2051 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2052 BindingFlags.Static | BindingFlags.SetField,
2053 null, null, new object [0]);
2054 Assert.Fail ("#A1");
2055 } catch (ArgumentException ex) {
2056 // Only the field value can be specified to set
2058 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
2059 Assert.IsNull (ex.InnerException, "#A3");
2060 Assert.IsNotNull (ex.Message, "#A4");
2061 Assert.IsNotNull (ex.ParamName, "#A5");
2063 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2065 Assert.AreEqual ("invokeAttr", ex.ParamName, "#6");
2070 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2071 BindingFlags.Static | BindingFlags.SetField,
2073 Assert.Fail ("#B1");
2075 } catch (ArgumentNullException ex) {
2076 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2077 Assert.IsNull (ex.InnerException, "#B3");
2078 Assert.IsNotNull (ex.Message, "#B4");
2079 Assert.IsNotNull (ex.ParamName, "#B5");
2080 Assert.AreEqual ("providedArgs", ex.ParamName, "#B6");
2083 } catch (ArgumentException ex) {
2084 // Only the field value can be specified to set
2086 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
2087 Assert.IsNull (ex.InnerException, "#B3");
2088 Assert.IsNotNull (ex.Message, "#B4");
2089 Assert.IsNotNull (ex.ParamName, "#B5");
2091 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
2093 Assert.AreEqual ("invokeAttr", ex.ParamName, "#B6");
2099 [Test] // bug #336841
2100 [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306797
2101 public void InvokeMember_VarArgs ()
2103 BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.Public |
2104 BindingFlags.NonPublic | BindingFlags.OptionalParamBinding |
2105 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2106 BindingFlags.Instance;
2108 Type type = typeof (TypeTest);
2109 string result = (string) type.InvokeMember ("bug336841",
2110 flags, null, null, new object [] { "1" });
2111 Assert.IsNotNull (result, "#A1");
2112 Assert.AreEqual ("#B:1", result, "#A2");
2114 result = (string) type.InvokeMember ("bug336841", flags,
2115 null, null, new object [] { "1", "2", "3", "4" });
2116 Assert.IsNotNull (result, "#B1");
2117 Assert.AreEqual ("#A:1|2,3,4", result, "#B2");
2121 [Test] // bug #348522
2122 public void InvokeMember_WithoutDefaultValue ()
2124 BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;
2126 typeof (Bug348522).InvokeMember ("Test", flags, new FirstMethodBinder (), new Bug348522(),
2127 new object [] {Missing.Value}, null, null, null);
2129 } catch (ArgumentException ex) {
2130 // Missing parameter does not have a default value
2131 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2132 Assert.IsNull (ex.InnerException, "#3");
2133 Assert.IsNotNull (ex.Message, "#4");
2134 Assert.IsNotNull (ex.ParamName, "#5");
2135 Assert.AreEqual ("parameters", ex.ParamName, "#6");
2140 public void InvokeMember_OutParam ()
2142 object[] args = new object[] { new string [0] };
2143 typeof (TypeTest).InvokeMember ("OutTest", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, args);
2144 Assert.IsTrue (args [0] is string[]);
2145 Assert.AreEqual (10, ((string[])args[0]).Length);
2148 public static void OutTest (out string[] a1)
2150 a1 = new string [10];
2155 public static int Value;
2164 public Z (IComparable value)
2169 public static void Run ()
2177 public TakesInt (int x)
2182 public int Integer {
2189 public TakesObject (object x) {}
2192 [Test] // bug #75241
2193 public void GetConstructorNullInTypes ()
2195 // This ends up calling type.GetConstructor ()
2196 Activator.CreateInstance (typeof (TakesInt), new object [] { null });
2197 Activator.CreateInstance (typeof (TakesObject), new object [] { null });
2201 public void GetConstructor_TakeInt_Object ()
2203 Assert.IsNull (typeof (TakesInt).GetConstructor (new Type[1] { typeof (object) }));
2207 public void GetCustomAttributes_All ()
2209 object [] attrs = typeof (A).GetCustomAttributes (false);
2210 Assert.AreEqual (2, attrs.Length, "#A1");
2211 Assert.IsTrue (HasAttribute (attrs, typeof (FooAttribute)), "#A2");
2212 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#A3");
2214 attrs = typeof (BA).GetCustomAttributes (false);
2215 Assert.AreEqual (1, attrs.Length, "#B1");
2216 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#B2");
2218 attrs = typeof (BA).GetCustomAttributes (true);
2219 Assert.AreEqual (2, attrs.Length, "#C1");
2220 Assert.IsTrue (HasAttribute (attrs, typeof (BarAttribute)), "#C2");
2221 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#C3");
2223 attrs = typeof (CA).GetCustomAttributes (false);
2224 Assert.AreEqual (0, attrs.Length, "#D");
2226 attrs = typeof (CA).GetCustomAttributes (true);
2227 Assert.AreEqual (1, attrs.Length, "#E1");
2228 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E2");
2231 static bool HasAttribute (object [] attrs, Type attributeType)
2233 foreach (object attr in attrs)
2234 if (attr.GetType () == attributeType)
2240 public void GetCustomAttributes_Type ()
2242 object [] attrs = null;
2244 attrs = typeof (A).GetCustomAttributes (
2245 typeof (VolatileModifier), false);
2246 Assert.AreEqual (1, attrs.Length, "#A1");
2247 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A2");
2248 attrs = typeof (A).GetCustomAttributes (
2249 typeof (VolatileModifier), true);
2250 Assert.AreEqual (1, attrs.Length, "#A3");
2251 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A4");
2253 attrs = typeof (A).GetCustomAttributes (
2254 typeof (NemerleAttribute), false);
2255 Assert.AreEqual (1, attrs.Length, "#B1");
2256 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B2");
2257 attrs = typeof (A).GetCustomAttributes (
2258 typeof (NemerleAttribute), true);
2259 Assert.AreEqual (1, attrs.Length, "#B3");
2260 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B4");
2262 attrs = typeof (A).GetCustomAttributes (
2263 typeof (FooAttribute), false);
2264 Assert.AreEqual (1, attrs.Length, "#C1");
2265 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C2");
2266 attrs = typeof (A).GetCustomAttributes (
2267 typeof (FooAttribute), false);
2268 Assert.AreEqual (1, attrs.Length, "#C3");
2269 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C4");
2271 attrs = typeof (BA).GetCustomAttributes (
2272 typeof (VolatileModifier), false);
2273 Assert.AreEqual (0, attrs.Length, "#D1");
2274 attrs = typeof (BA).GetCustomAttributes (
2275 typeof (VolatileModifier), true);
2276 Assert.AreEqual (1, attrs.Length, "#D2");
2277 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#D3");
2279 attrs = typeof (BA).GetCustomAttributes (
2280 typeof (NemerleAttribute), false);
2281 Assert.AreEqual (0, attrs.Length, "#E1");
2282 attrs = typeof (BA).GetCustomAttributes (
2283 typeof (NemerleAttribute), true);
2284 Assert.AreEqual (1, attrs.Length, "#E2");
2285 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E3");
2287 attrs = typeof (BA).GetCustomAttributes (
2288 typeof (FooAttribute), false);
2289 Assert.AreEqual (1, attrs.Length, "#F1");
2290 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F2");
2291 attrs = typeof (BA).GetCustomAttributes (
2292 typeof (FooAttribute), true);
2293 Assert.AreEqual (1, attrs.Length, "#F3");
2294 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F4");
2296 attrs = typeof (bug82431A1).GetCustomAttributes (
2297 typeof (InheritAttribute), false);
2298 Assert.AreEqual (1, attrs.Length, "#G1");
2299 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G2");
2300 attrs = typeof (bug82431A1).GetCustomAttributes (
2301 typeof (InheritAttribute), true);
2302 Assert.AreEqual (1, attrs.Length, "#G3");
2303 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G4");
2305 attrs = typeof (bug82431A1).GetCustomAttributes (
2306 typeof (NotInheritAttribute), false);
2307 Assert.AreEqual (1, attrs.Length, "#H1");
2308 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H2");
2309 attrs = typeof (bug82431A1).GetCustomAttributes (
2310 typeof (InheritAttribute), true);
2311 Assert.AreEqual (1, attrs.Length, "#H3");
2312 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H4");
2314 attrs = typeof (bug82431A2).GetCustomAttributes (
2315 typeof (InheritAttribute), false);
2316 Assert.AreEqual (0, attrs.Length, "#I1");
2317 attrs = typeof (bug82431A2).GetCustomAttributes (
2318 typeof (InheritAttribute), true);
2319 Assert.AreEqual (0, attrs.Length, "#I2");
2321 attrs = typeof (bug82431A2).GetCustomAttributes (
2322 typeof (NotInheritAttribute), false);
2323 Assert.AreEqual (0, attrs.Length, "#J1");
2324 attrs = typeof (bug82431A2).GetCustomAttributes (
2325 typeof (NotInheritAttribute), true);
2326 Assert.AreEqual (0, attrs.Length, "#J2");
2328 attrs = typeof (bug82431A3).GetCustomAttributes (
2329 typeof (InheritAttribute), false);
2330 Assert.AreEqual (2, attrs.Length, "#K1");
2331 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K2");
2332 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K3");
2333 attrs = typeof (bug82431A3).GetCustomAttributes (
2334 typeof (InheritAttribute), true);
2335 Assert.AreEqual (2, attrs.Length, "#K4");
2336 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K5");
2337 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K6");
2339 attrs = typeof (bug82431A3).GetCustomAttributes (
2340 typeof (NotInheritAttribute), false);
2341 Assert.AreEqual (1, attrs.Length, "#L1");
2342 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L2");
2343 attrs = typeof (bug82431A3).GetCustomAttributes (
2344 typeof (NotInheritAttribute), true);
2345 Assert.AreEqual (1, attrs.Length, "#L3");
2346 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L4");
2348 attrs = typeof (bug82431B1).GetCustomAttributes (
2349 typeof (InheritAttribute), false);
2350 Assert.AreEqual (1, attrs.Length, "#M1");
2351 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M2");
2352 attrs = typeof (bug82431B1).GetCustomAttributes (
2353 typeof (InheritAttribute), true);
2354 Assert.AreEqual (1, attrs.Length, "#M3");
2355 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M4");
2357 attrs = typeof (bug82431B1).GetCustomAttributes (
2358 typeof (NotInheritAttribute), false);
2359 Assert.AreEqual (0, attrs.Length, "#N1");
2360 attrs = typeof (bug82431B1).GetCustomAttributes (
2361 typeof (NotInheritAttribute), true);
2362 Assert.AreEqual (0, attrs.Length, "#N2");
2364 attrs = typeof (bug82431B2).GetCustomAttributes (
2365 typeof (InheritAttribute), false);
2366 Assert.AreEqual (0, attrs.Length, "#O1");
2367 attrs = typeof (bug82431B2).GetCustomAttributes (
2368 typeof (InheritAttribute), true);
2369 Assert.AreEqual (1, attrs.Length, "#O2");
2370 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#O3");
2372 attrs = typeof (bug82431B2).GetCustomAttributes (
2373 typeof (NotInheritAttribute), false);
2374 Assert.AreEqual (0, attrs.Length, "#P1");
2375 attrs = typeof (bug82431B2).GetCustomAttributes (
2376 typeof (NotInheritAttribute), true);
2377 Assert.AreEqual (0, attrs.Length, "#P2");
2379 attrs = typeof (bug82431B3).GetCustomAttributes (
2380 typeof (InheritAttribute), false);
2381 Assert.AreEqual (1, attrs.Length, "#Q1");
2382 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q2");
2383 attrs = typeof (bug82431B3).GetCustomAttributes (
2384 typeof (InheritAttribute), true);
2385 Assert.AreEqual (2, attrs.Length, "#Q3");
2386 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q4");
2387 Assert.AreEqual (typeof (InheritAttribute), attrs [1].GetType (), "#Q5");
2389 attrs = typeof (bug82431B3).GetCustomAttributes (
2390 typeof (NotInheritAttribute), false);
2391 Assert.AreEqual (1, attrs.Length, "#R1");
2392 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R2");
2393 attrs = typeof (bug82431B3).GetCustomAttributes (
2394 typeof (NotInheritAttribute), true);
2395 Assert.AreEqual (1, attrs.Length, "#R3");
2396 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R4");
2398 attrs = typeof (bug82431B4).GetCustomAttributes (
2399 typeof (InheritAttribute), false);
2400 Assert.AreEqual (0, attrs.Length, "#S1");
2401 attrs = typeof (bug82431B4).GetCustomAttributes (
2402 typeof (InheritAttribute), true);
2403 Assert.AreEqual (1, attrs.Length, "#S2");
2404 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#S3");
2406 attrs = typeof (bug82431B4).GetCustomAttributes (
2407 typeof (NotInheritAttribute), false);
2408 Assert.AreEqual (0, attrs.Length, "#T1");
2409 attrs = typeof (bug82431B4).GetCustomAttributes (
2410 typeof (NotInheritAttribute), true);
2411 Assert.AreEqual (0, attrs.Length, "#T2");
2413 attrs = typeof (A).GetCustomAttributes (
2414 typeof (string), false);
2415 Assert.AreEqual (0, attrs.Length, "#U1");
2416 attrs = typeof (A).GetCustomAttributes (
2417 typeof (string), true);
2418 Assert.AreEqual (0, attrs.Length, "#U2");
2421 [Test] // bug #76150
2422 public void IsDefined ()
2424 Assert.IsTrue (typeof (A).IsDefined (typeof (NemerleAttribute), false), "#A1");
2425 Assert.IsTrue (typeof (A).IsDefined (typeof (VolatileModifier), false), "#A2");
2426 Assert.IsTrue (typeof (A).IsDefined (typeof (FooAttribute), false), "#A3");
2427 Assert.IsFalse (typeof (A).IsDefined (typeof (BarAttribute), false), "#A4");
2429 Assert.IsFalse (typeof (BA).IsDefined (typeof (NemerleAttribute), false), "#B1");
2430 Assert.IsFalse (typeof (BA).IsDefined (typeof (VolatileModifier), false), "#B2");
2431 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), false), "#B3");
2432 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), false), "#B4");
2433 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), false), "#B5");
2434 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), false), "#B6");
2435 Assert.IsTrue (typeof (BA).IsDefined (typeof (NemerleAttribute), true), "#B7");
2436 Assert.IsTrue (typeof (BA).IsDefined (typeof (VolatileModifier), true), "#B8");
2437 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), true), "#B9");
2438 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), true), "#B10");
2439 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), true), "#B11");
2440 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), true), "#B12");
2444 public void IsDefined_AttributeType_Null ()
2447 typeof (BA).IsDefined ((Type) null, false);
2449 } catch (ArgumentNullException ex) {
2450 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2451 Assert.IsNull (ex.InnerException, "#3");
2452 Assert.IsNotNull (ex.Message, "#4");
2453 Assert.IsNotNull (ex.ParamName, "#5");
2454 Assert.AreEqual ("attributeType", ex.ParamName, "#6");
2458 [Test] // bug #82431
2460 [Category ("NotWorking")]
2462 public void IsDefined_Inherited ()
2464 Assert.IsFalse (typeof (CA).IsDefined (typeof (NemerleAttribute), false), "#C1");
2465 Assert.IsFalse (typeof (CA).IsDefined (typeof (VolatileModifier), false), "#C2");
2466 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), false), "#C3");
2467 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), false), "#C4");
2468 Assert.IsTrue (typeof (CA).IsDefined (typeof (NemerleAttribute), true), "#C5");
2469 Assert.IsTrue (typeof (CA).IsDefined (typeof (VolatileModifier), true), "#C6");
2470 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), true), "#C7");
2471 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), true), "#C8");
2473 Assert.IsFalse (typeof (BBA).IsDefined (typeof (NemerleAttribute), false), "#D1");
2474 Assert.IsFalse (typeof (BBA).IsDefined (typeof (VolatileModifier), false), "#D2");
2475 Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), false), "#D3");
2476 Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), false), "#D4");
2477 Assert.IsTrue (typeof (BBA).IsDefined (typeof (NemerleAttribute), true), "#D5");
2478 Assert.IsTrue (typeof (BBA).IsDefined (typeof (VolatileModifier), true), "#D6");
2480 Assert.IsTrue (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2481 Assert.IsTrue (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2483 Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2484 Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2487 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), false), "#E1");
2488 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), false), "#E2");
2489 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), true), "#E3");
2490 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), true), "#E4");
2492 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), false), "#F1");
2493 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), false), "#F2");
2495 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2497 Assert.IsTrue (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2499 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), true), "#F4");
2501 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), false), "#G1");
2502 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), false), "#G2");
2503 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), true), "#G3");
2504 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), true), "#G4");
2506 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), false), "#H1");
2507 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), false), "#H2");
2508 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), true), "#H3");
2509 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), true), "#H4");
2511 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), false), "#I1");
2512 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), false), "#I2");
2513 Assert.IsTrue (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), true), "#I3");
2514 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), true), "#I4");
2516 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), false), "#J1");
2517 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), false), "#J2");
2518 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), true), "#J3");
2519 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), true), "#J4");
2521 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), false), "#K2");
2522 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), false), "#K2");
2523 Assert.IsTrue (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), true), "#K3");
2524 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
2527 [Test] // GetType (String)
2528 public void GetType1_TypeName_Null ()
2531 Type.GetType ((string) null);
2533 } catch (ArgumentNullException ex) {
2534 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2535 Assert.IsNull (ex.InnerException, "#3");
2536 Assert.IsNotNull (ex.Message, "#4");
2538 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2540 Assert.AreEqual ("className", ex.ParamName, "#5");
2545 [Test] // GetType (String, Boolean)
2546 public void GetType2_TypeName_Null ()
2549 Type.GetType ((string) null, false);
2551 } catch (ArgumentNullException ex) {
2552 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2553 Assert.IsNull (ex.InnerException, "#3");
2554 Assert.IsNotNull (ex.Message, "#4");
2556 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2558 Assert.AreEqual ("className", ex.ParamName, "#5");
2563 [Test] // GetType (String, Boolean, Boolean)
2564 public void GetType3_TypeName_Null ()
2567 Type.GetType ((string) null, false, false);
2569 } catch (ArgumentNullException ex) {
2570 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2571 Assert.IsNull (ex.InnerException, "#3");
2572 Assert.IsNotNull (ex.Message, "#4");
2574 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2576 Assert.AreEqual ("className", ex.ParamName, "#5");
2582 public void GetTypeArray_Args_Null ()
2585 Type.GetTypeArray ((object []) null);
2587 } catch (ArgumentNullException ex) {
2588 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2589 Assert.IsNull (ex.InnerException, "#3");
2590 Assert.IsNotNull (ex.Message, "#4");
2591 Assert.AreEqual ("args", ex.ParamName, "#5");
2596 public void GetTypeCode ()
2598 Assert.AreEqual (TypeCode.Boolean, Type.GetTypeCode (typeof (bool)), "#1");
2599 Assert.AreEqual (TypeCode.Byte, Type.GetTypeCode (typeof (byte)), "#2");
2600 Assert.AreEqual (TypeCode.Char, Type.GetTypeCode (typeof (char)), "#3");
2601 Assert.AreEqual (TypeCode.DateTime, Type.GetTypeCode (typeof (DateTime)), "#4");
2602 Assert.AreEqual (TypeCode.DBNull, Type.GetTypeCode (typeof (DBNull)), "#5");
2603 Assert.AreEqual (TypeCode.Decimal, Type.GetTypeCode (typeof (decimal)), "#6");
2604 Assert.AreEqual (TypeCode.Double, Type.GetTypeCode (typeof (double)), "#7");
2605 Assert.AreEqual (TypeCode.Empty, Type.GetTypeCode (null), "#8");
2606 Assert.AreEqual (TypeCode.Int16, Type.GetTypeCode (typeof (short)), "#9");
2607 Assert.AreEqual (TypeCode.Int32, Type.GetTypeCode (typeof (int)), "#10");
2608 Assert.AreEqual (TypeCode.Int64, Type.GetTypeCode (typeof (long)), "#11");
2609 Assert.AreEqual (TypeCode.Object, Type.GetTypeCode (typeof (TakesInt)), "#12");
2610 Assert.AreEqual (TypeCode.SByte, Type.GetTypeCode (typeof (sbyte)), "#13");
2611 Assert.AreEqual (TypeCode.Single, Type.GetTypeCode (typeof (float)), "#14");
2612 Assert.AreEqual (TypeCode.String, Type.GetTypeCode (typeof (string)), "#15");
2613 Assert.AreEqual (TypeCode.UInt16, Type.GetTypeCode (typeof (ushort)), "#16");
2614 Assert.AreEqual (TypeCode.UInt32, Type.GetTypeCode (typeof (uint)), "#17");
2615 Assert.AreEqual (TypeCode.UInt64, Type.GetTypeCode (typeof (ulong)), "#18");
2619 public void GetTypeFromHandle_Handle_Zero ()
2621 RuntimeTypeHandle handle = new RuntimeTypeHandle ();
2624 Assert.IsNull (Type.GetTypeFromHandle (handle));
2627 Type.GetTypeFromHandle (handle);
2629 } catch (ArgumentException ex) {
2630 // Handle is not initialized
2631 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2632 Assert.IsNull (ex.InnerException, "#3");
2633 Assert.IsNotNull (ex.Message, "#4");
2634 Assert.IsNull (ex.ParamName, "#5");
2640 public void GetTypeHandle_O_Null ()
2643 Type.GetTypeHandle (null);
2645 } catch (ArgumentNullException ex) {
2646 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2647 Assert.IsNull (ex.InnerException, "#3");
2648 Assert.IsNotNull (ex.Message, "#4");
2650 Assert.IsNull (ex.ParamName, "#5");
2652 Assert.AreEqual ("o", ex.ParamName, "#5");
2657 [Test] // GetConstructor (Type [])
2658 public void GetConstructor1 ()
2661 ConstructorInfo ctor;
2663 type = typeof (CtorsA);
2664 ctor = type.GetConstructor (Type.EmptyTypes);
2665 Assert.IsNotNull (ctor, "#A1");
2666 Assert.AreEqual (0, ctor.GetParameters ().Length, "#A2");
2667 Assert.IsFalse (ctor.IsStatic, "#A3");
2668 Assert.IsTrue (ctor.IsPublic, "#A4");
2669 Assert.AreEqual (".ctor", ctor.Name, "#A5");
2671 type = typeof (CtorsB);
2672 ctor = type.GetConstructor (Type.EmptyTypes);
2673 Assert.IsNotNull (ctor, "#B1");
2674 Assert.AreEqual (0, ctor.GetParameters ().Length, "#B2");
2675 Assert.IsFalse (ctor.IsStatic, "#B3");
2676 Assert.IsTrue (ctor.IsPublic, "#B4");
2677 Assert.AreEqual (".ctor", ctor.Name, "#B5");
2679 type = typeof (CtorsC);
2680 ctor = type.GetConstructor (Type.EmptyTypes);
2681 Assert.IsNull (ctor, "#C");
2683 type = typeof (CtorsC);
2684 ctor = type.GetConstructor (new Type [] { typeof (int) });
2685 Assert.IsNotNull (ctor, "#D1");
2686 Assert.AreEqual (1, ctor.GetParameters ().Length, "#D2");
2687 Assert.IsFalse (ctor.IsStatic, "#D3");
2688 Assert.IsTrue (ctor.IsPublic, "#D4");
2689 Assert.AreEqual (".ctor", ctor.Name, "#D5");
2692 [Test] // GetConstructor (Type [])
2693 public void GetConstructor1_Types_Null ()
2696 typeof (BindingFlags).GetConstructor (null);
2698 } catch (ArgumentNullException ex) {
2699 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2700 Assert.IsNull (ex.InnerException, "#3");
2701 Assert.IsNotNull (ex.Message, "#4");
2702 Assert.IsNotNull (ex.ParamName, "#5");
2703 Assert.AreEqual ("types", ex.ParamName, "#6");
2707 [Test] // GetConstructor (Type [])
2708 public void GetConstructor1_Types_ItemNull ()
2710 Type type = typeof (BindingFlags);
2712 type.GetConstructor (new Type[1] { null });
2713 Assert.Fail ("#A1");
2714 } catch (ArgumentNullException ex) {
2715 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
2716 Assert.IsNull (ex.InnerException, "#A3");
2717 Assert.IsNotNull (ex.Message, "#A4");
2718 Assert.IsNotNull (ex.ParamName, "#A5");
2719 Assert.AreEqual ("types", ex.ParamName, "#A6");
2722 type = typeof (TakesInt);
2724 type.GetConstructor (new Type [1] { null });
2725 Assert.Fail ("#B1");
2726 } catch (ArgumentNullException ex) {
2727 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2728 Assert.IsNull (ex.InnerException, "#B3");
2729 Assert.IsNotNull (ex.Message, "#B4");
2730 Assert.IsNotNull (ex.ParamName, "#B5");
2731 Assert.AreEqual ("types", ex.ParamName, "#B6");
2735 [Test] // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier [])
2736 public void GetConstructor2_Types_ItemNull ()
2738 Type type = typeof (BindingFlags);
2740 type.GetConstructor (BindingFlags.Default, null,
2741 new Type[1] { null }, null);
2743 } catch (ArgumentNullException ex) {
2744 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2745 Assert.IsNull (ex.InnerException, "#3");
2746 Assert.IsNotNull (ex.Message, "#4");
2747 Assert.IsNotNull (ex.ParamName, "#5");
2748 Assert.AreEqual ("types", ex.ParamName, "#6");
2752 [Test] // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier [])
2753 public void GetConstructor3_Types_ItemNull ()
2755 Type type = typeof (BindingFlags);
2757 type.GetConstructor (BindingFlags.Default,
2758 null, CallingConventions.Any,
2759 new Type[1] { null }, null);
2761 } catch (ArgumentNullException ex) {
2762 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2763 Assert.IsNull (ex.InnerException, "#3");
2764 Assert.IsNotNull (ex.Message, "#4");
2765 Assert.IsNotNull (ex.ParamName, "#5");
2766 Assert.AreEqual ("types", ex.ParamName, "#6");
2771 public void GetMethod_Bug77367 ()
2773 MethodInfo i = typeof (Bug77367).GetMethod ("Run", Type.EmptyTypes);
2777 #if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM
2779 public void EqualsUnderlyingType ()
2781 AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
2782 TypeAttributes attribs = TypeAttributes.Public;
2784 AssemblyName name = new AssemblyName ();
2785 name.Name = "enumtest";
2786 AssemblyBuilder assembly =
2787 AppDomain.CurrentDomain.DefineDynamicAssembly (
2790 ModuleBuilder module = assembly.DefineDynamicModule
2791 ("m", "enumtest.dll");
2792 EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
2794 Assert.IsTrue (typeof (int).Equals (e));
2796 #endif // TARGET_JVM
2799 public void Equals_Type_Null ()
2801 Assert.IsFalse (typeof (int).Equals ((Type) null), "#1");
2802 Assert.IsFalse (typeof (int).Equals ((object) null), "#2");
2806 public void GetElementType_Bug63841 ()
2808 Assert.IsNull (typeof (TheEnum).GetElementType (), "#1");
2813 public void FullNameGenerics ()
2815 Type fooType = typeof (Foo<>);
2816 FieldInfo [] fields = fooType.GetFields ();
2818 Assert.AreEqual (1, fields.Length, "#0");
2820 Assert.IsNotNull (fooType.FullName, "#1");
2821 Assert.IsNotNull (fooType.AssemblyQualifiedName, "#1a");
2823 FieldInfo field = fooType.GetField ("Whatever");
2824 Assert.IsNotNull (field, "#2");
2825 Assert.AreEqual (field, fields [0], "#2a");
2826 Assert.IsNull (field.FieldType.FullName, "#3");
2827 Assert.IsNull (field.FieldType.AssemblyQualifiedName, "#3a");
2828 Assert.IsNotNull (field.FieldType.ToString (), "#4");
2830 PropertyInfo prop = fooType.GetProperty ("Test");
2831 Assert.IsNotNull (prop, "#5");
2832 Assert.IsNull (prop.PropertyType.FullName, "#6");
2833 Assert.IsNull (prop.PropertyType.AssemblyQualifiedName, "#6a");
2834 Assert.IsNotNull (prop.PropertyType.ToString (), "#7");
2836 MethodInfo method = fooType.GetMethod("Execute");
2837 Assert.IsNotNull (method, "#8");
2838 Assert.IsNull (method.ReturnType.FullName, "#9");
2839 Assert.IsNull (method.ReturnType.AssemblyQualifiedName, "#9a");
2840 Assert.IsNotNull (method.ReturnType.ToString (), "#10");
2842 ParameterInfo[] parameters = method.GetParameters();
2843 Assert.AreEqual (1, parameters.Length, "#11");
2844 Assert.IsNull (parameters[0].ParameterType.FullName, "#12");
2845 Assert.IsNull (parameters[0].ParameterType.AssemblyQualifiedName, "#12a");
2846 Assert.IsNotNull (parameters[0].ParameterType.ToString (), "#13");
2850 public void TypeParameterIsNotGeneric ()
2852 Type fooType = typeof (Foo<>);
2853 Type type_param = fooType.GetGenericArguments () [0];
2854 Assert.IsTrue (type_param.IsGenericParameter);
2855 Assert.IsFalse (type_param.IsGenericType);
2856 Assert.IsFalse (type_param.IsGenericTypeDefinition);
2858 // LAMESPEC: MSDN claims that this should be false, but .NET v2.0.50727 says it's true
2859 // http://msdn2.microsoft.com/en-us/library/system.type.isgenerictype.aspx
2860 Assert.IsTrue (type_param.ContainsGenericParameters);
2864 public void IsAssignable ()
2866 Type foo_type = typeof (Foo<>);
2867 Type foo_int_type = typeof (Foo<int>);
2868 Assert.IsFalse (foo_type.IsAssignableFrom (foo_int_type), "Foo<int> -!-> Foo<>");
2869 Assert.IsFalse (foo_int_type.IsAssignableFrom (foo_type), "Foo<> -!-> Foo<int>");
2871 Type ibar_short_type = typeof (IBar<short>);
2872 Type ibar_int_type = typeof (IBar<int>);
2873 Type baz_short_type = typeof (Baz<short>);
2874 Type baz_int_type = typeof (Baz<int>);
2876 Assert.IsTrue (ibar_int_type.IsAssignableFrom (baz_int_type), "Baz<int> -> IBar<int>");
2877 Assert.IsTrue (ibar_short_type.IsAssignableFrom (baz_short_type), "Baz<short> -> IBar<short>");
2879 Assert.IsFalse (ibar_int_type.IsAssignableFrom (baz_short_type), "Baz<short> -!-> IBar<int>");
2880 Assert.IsFalse (ibar_short_type.IsAssignableFrom (baz_int_type), "Baz<int> -!-> IBar<short>");
2883 Assert.IsTrue (typeof (Nullable<int>).IsAssignableFrom (typeof (int)));
2884 Assert.IsFalse (typeof (int).IsAssignableFrom (typeof (Nullable<int>)));
2885 Assert.IsTrue (typeof (Nullable<FooStruct>).IsAssignableFrom (typeof (FooStruct)));
2889 public void IsInstanceOf ()
2891 Assert.IsTrue (typeof (Nullable<int>).IsInstanceOfType (5));
2895 public void IsInstanceOfArrayOfNullable ()
2897 Assert.IsTrue (typeof (Nullable<int>[]).IsInstanceOfType (new Nullable<int> [0]));
2901 public void ByrefType ()
2903 Type foo_type = typeof (Foo<>);
2904 Type type_param = foo_type.GetGenericArguments () [0];
2905 Type byref_type_param = type_param.MakeByRefType ();
2906 Assert.IsFalse (byref_type_param.IsGenericParameter);
2907 Assert.IsNull (byref_type_param.DeclaringType);
2911 public class ComFoo<T> {
2915 public void GetCustomAttributesGenericInstance ()
2917 Assert.AreEqual (1, typeof (ComFoo<int>).GetCustomAttributes (typeof (ComVisibleAttribute), true).Length);
2920 interface ByRef1<T> { void f (ref T t); }
2921 interface ByRef2 { void f<T> (ref T t); }
2923 interface ByRef3<T> where T:struct { void f (ref T? t); }
2924 interface ByRef4 { void f<T> (ref T? t) where T:struct; }
2926 void CheckGenericByRef (Type t)
2928 string name = t.Name;
2929 t = t.GetMethod ("f").GetParameters () [0].ParameterType;
2931 Assert.IsFalse (t.IsGenericType, name);
2932 Assert.IsFalse (t.IsGenericTypeDefinition, name);
2933 Assert.IsFalse (t.IsGenericParameter, name);
2937 public void GenericByRef ()
2939 CheckGenericByRef (typeof (ByRef1<>));
2940 CheckGenericByRef (typeof (ByRef2));
2941 CheckGenericByRef (typeof (ByRef3<>));
2942 CheckGenericByRef (typeof (ByRef4));
2945 public class Bug80242<T> {
2946 public interface IFoo { }
2947 public class Bar : IFoo { }
2948 public class Baz : Bar { }
2952 public void TestNestedTypes ()
2954 Type t = typeof (Bug80242<object>);
2955 Assert.IsFalse (t.IsGenericTypeDefinition);
2956 foreach (Type u in t.GetNestedTypes ()) {
2957 Assert.IsTrue (u.IsGenericTypeDefinition, "{0} isn't a generic definition", u);
2958 Assert.AreEqual (u, u.GetGenericArguments () [0].DeclaringType);
2962 [Test] // bug #82211
2963 public void GetMembers_GenericArgument ()
2965 Type argType = typeof (ComFoo<>).GetGenericArguments () [0];
2966 MemberInfo [] members = argType.GetMembers ();
2967 Assert.IsNotNull (members, "#1");
2968 Assert.AreEqual (4, members.Length, "#2");
2972 [ExpectedException (typeof (ArgumentNullException))]
2973 public void ReflectionOnlyGetTypeNullTypeName ()
2975 Type.ReflectionOnlyGetType (null, false, false);
2979 public void ReflectionOnlyGetTypeDoNotThrow ()
2981 Assert.IsNull (Type.ReflectionOnlyGetType ("a, nonexistent.dll", false, false));
2985 [ExpectedException (typeof (FileNotFoundException))]
2986 public void ReflectionOnlyGetTypeThrow ()
2988 Type.ReflectionOnlyGetType ("a, nonexistent.dll", true, false);
2992 public void ReflectionOnlyGetType ()
2994 Type t = Type.ReflectionOnlyGetType (typeof (int).AssemblyQualifiedName.ToString (), true, true);
2995 Assert.AreEqual ("System.Int32", t.FullName);
2998 [Test] //bug #331199
2999 //FIXME: 2.0 SP 1 has a diferent behavior
3000 public void MakeGenericType_UserDefinedType ()
3002 Type ut = new UserType (typeof (int));
3003 Type t = typeof (Foo<>).MakeGenericType (ut);
3004 Assert.IsTrue (t.IsGenericType, "#A1");
3005 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
3007 Type arg = t.GetGenericArguments () [0];
3008 Assert.IsNotNull (arg, "#B1");
3009 Assert.IsFalse (arg.IsGenericType, "#B2");
3010 Assert.AreEqual (typeof (int), arg, "#B3");
3013 [Category ("NotWorking")]
3014 //We dont support instantiating a user type
3015 public void MakeGenericType_NestedUserDefinedType ()
3017 Type ut = new UserType (new UserType (typeof (int)));
3018 Type t = typeof (Foo<>).MakeGenericType (ut);
3019 Assert.IsTrue (t.IsGenericType, "#A1");
3020 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
3022 Type arg = t.GetGenericArguments () [0];
3023 Assert.IsNotNull (arg, "#B1");
3024 Assert.IsFalse (arg.IsGenericType, "#B2");
3025 Assert.AreEqual (ut, arg, "#B3");
3029 [Category ("NotWorking")]
3030 public void TestMakeGenericType_UserDefinedType_DotNet20SP1 ()
3032 Type ut = new UserType(typeof(int));
3033 Type t = typeof(Foo<>).MakeGenericType(ut);
3034 Assert.IsTrue (t.IsGenericType, "#1");
3036 Assert.AreEqual (ut, t.GetGenericArguments()[0], "#2");
3040 public void MakeGenericType_BadUserType ()
3042 Type ut = new UserType (null);
3044 Type t = typeof (Foo<>).MakeGenericType (ut);
3046 } catch (ArgumentException) {
3051 public void MakeGenericType_WrongNumOfArguments ()
3054 Type t = typeof (Foo<,>).MakeGenericType (new Type [] { typeof (int) });
3056 } catch (ArgumentException) {
3060 [AttributeUsage (AttributeTargets.All)]
3061 public class DocAttribute : Attribute {
3062 public DocAttribute (string docs) {}
3065 class GenericClassWithAttributes<[Doc ("T")] T, [Doc ("B")] B>
3066 where T : class, new ()
3069 public T Bar { get{return null;}}
3071 public void M<[Doc ("X")] X> (X x)
3076 [Test] //bug #377596
3077 public void GetGenericArguments_ArgumentsHaveAttributes ()
3079 Type type = typeof(GenericClassWithAttributes<,>);
3080 Type[] tArgs = type.GetGenericArguments ();
3081 MethodInfo m = type.GetMethod ("M");
3082 Type[] mArgs = m.GetGenericArguments ();
3083 Assert.AreEqual(1, tArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3084 Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3085 Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3088 [Test] //bug #471255
3089 public void GetTypeCalledUsingReflection ()
3091 Type expectedType = Type.GetType ("NoNamespaceClass");
3092 Assert.IsNotNull (expectedType, "#1");
3093 MethodInfo m = typeof (Type).GetMethod ("GetType", BindingFlags.Public | BindingFlags.Static, null, new Type [] { typeof (string) }, null);
3094 object r = m.Invoke (null, BindingFlags.Default, null, new object [] { "NoNamespaceClass" }, CultureInfo.InvariantCulture);
3095 Assert.AreSame (expectedType, r, "#2");
3099 public void EqualsUserType () {
3100 UserType2 t1 = new UserType2(null);
3101 UserType2 t2 = new UserType2(t1);
3102 Assert.IsTrue (t1.Equals(t2));
3106 public void GetHashCodeUserType () {
3107 UserType2 t1 = new UserType2(null);
3108 UserType2 t2 = new UserType2(t1);
3109 Assert.AreEqual (42, t2.GetHashCode());
3113 public void IsGenericTypeDefinitionUserType () {
3114 Assert.IsFalse (new UserType(null).IsGenericTypeDefinition);
3118 public void IsGenericTypeUserType () {
3119 Assert.IsFalse (new UserType(null).IsGenericType);
3123 [ExpectedException (typeof (NotSupportedException))]
3124 public void GetGenericTypeDefinitionUserType () {
3125 new UserType(null).GetGenericTypeDefinition ();
3128 [ExpectedException (typeof (NotSupportedException))]
3129 public void GetGenericArgumentsUserType () {
3130 new UserType(null).GetGenericArguments ();
3134 [ExpectedException (typeof (InvalidOperationException))]
3135 public void GenericParameterPositionUserType () {
3136 Assert.IsTrue (new UserType(null).GenericParameterPosition == 0);
3141 public void TypeGetMemberReturnTypeTest ()
3144 MemberTypes memtype;
3146 object [] flagsandtypes = new object [] {
3147 MemberTypes.All, typeof (MemberInfo []),
3148 MemberTypes.Constructor, typeof (ConstructorInfo []),
3149 MemberTypes.Custom, typeof (MemberInfo []),
3150 MemberTypes.Event, typeof (EventInfo []),
3151 MemberTypes.Field, typeof (FieldInfo []),
3152 MemberTypes.Method, typeof (MethodInfo []),
3153 MemberTypes.NestedType, typeof (Type []),
3154 MemberTypes.Property, typeof (PropertyInfo []),
3155 MemberTypes.TypeInfo, typeof (Type [])};
3157 for (int i=0; i < flagsandtypes.Length; i+=2) {
3158 memtype = (MemberTypes)flagsandtypes [i];
3159 testtype = (Type)flagsandtypes [i+1];
3160 obj = GetType ().GetMember ("DummyMember", memtype,
3161 BindingFlags.Public | BindingFlags.Instance);
3162 Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
3163 "Expected " + testtype.FullName);
3169 public void TypeNameStartsWithSpace ()
3171 Type t1 = Type.GetType ("System.Type, mscorlib");
3172 Type t2 = Type.GetType (" System.Type, mscorlib");
3173 Assert.AreEqual (t1, t2);
3178 public void Bug506757 ()
3180 AssemblyName assemblyName = new AssemblyName ();
3181 assemblyName.Name = "customMod";
3182 assemblyName.Version = new Version (1, 2, 3, 4);
3184 AssemblyBuilder assembly
3185 = Thread.GetDomain().DefineDynamicAssembly(
3186 assemblyName, AssemblyBuilderAccess.RunAndSave);
3188 ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
3190 TypeBuilder type0 = module.DefineType ("Base", TypeAttributes.Public, typeof (object));
3191 TypeBuilder type1 = module.DefineType ("Middle", TypeAttributes.Public, type0);
3192 TypeBuilder type2 = module.DefineType ("End", TypeAttributes.Public, type1);
3194 MethodAttributes attrs0 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3195 MethodAttributes.NewSlot | MethodAttributes.FamORAssem;
3197 MethodAttributes attrs1 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3198 MethodAttributes.FamORAssem;
3200 MethodAttributes attrs2 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3201 MethodAttributes.Public;
3204 MethodBuilder m0 = type0.DefineMethod ("Tst", attrs0, typeof (void), null);
3205 m0.GetILGenerator ().Emit (OpCodes.Ret);
3207 MethodBuilder m1 = type1.DefineMethod ("Tst", attrs1, typeof (void), null);
3208 m1.GetILGenerator ().Emit (OpCodes.Ret);
3210 MethodBuilder m2 = type2.DefineMethod ("Tst", attrs2, typeof (void), null);
3211 m2.GetILGenerator ().Emit (OpCodes.Ret);
3214 type0.CreateType ();
3215 type1.CreateType ();
3216 Type t2 = type2.CreateType ();
3218 foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
3219 Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
3221 static bool ContainsProperty (PropertyInfo [] props, string name)
3223 foreach (PropertyInfo p in props)
3229 public class NemerleAttribute : Attribute
3233 public class VolatileModifier : NemerleAttribute
3243 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3244 public class FooAttribute : Attribute
3248 public class BarAttribute : FooAttribute
3265 [AttributeUsage (AttributeTargets.Class, Inherited=true)]
3266 public class InheritAttribute : Attribute
3270 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3271 public class NotInheritAttribute : InheritAttribute
3275 [NotInheritAttribute]
3276 public class bug82431A1
3280 public class bug82431A2 : bug82431A1
3284 [NotInheritAttribute]
3286 public class bug82431A3 : bug82431A1
3291 public class bug82431B1
3295 public class bug82431B2 : bug82431B1
3299 [NotInheritAttribute]
3300 public class bug82431B3 : bug82431B2
3304 public class bug82431B4 : bug82431B3
3312 public class Bug77367
3314 public void Run (bool b)
3321 private string PrivInstBlue
3323 get { return null; }
3326 protected string ProtInstBlue
3328 get { return null; }
3331 protected internal string ProIntInstBlue
3333 get { return null; }
3336 public long PubInstBlue
3340 if (PrivInstBlue == null)
3342 return long.MaxValue;
3346 internal int IntInstBlue
3351 private static string PrivStatBlue
3353 get { return null; }
3356 protected static string ProtStatBlue
3358 get { return null; }
3361 protected static internal string ProIntStatBlue
3363 get { return null; }
3366 public static long PubStatBlue
3370 if (PrivStatBlue == null)
3372 return long.MaxValue;
3376 internal static int IntStatBlue
3382 public class Foo : Blue
3384 private string PrivInstBase
3386 get { return null; }
3389 protected string ProtInstBase
3391 get { return null; }
3394 protected internal string ProIntInstBase
3396 get { return null; }
3399 public long PubInstBase
3403 if (PrivInstBase == null)
3405 return long.MaxValue;
3409 internal int IntInstBase
3414 private static string PrivStatBase
3416 get { return null; }
3419 protected static string ProtStatBase
3421 get { return null; }
3424 protected static internal string ProIntStatBase
3426 get { return null; }
3429 public static long PubStatBase
3433 if (PrivStatBase == null)
3435 return long.MaxValue;
3439 internal static int IntStatBase
3445 public class Bar : Foo
3447 private string PrivInst
3449 get { return null; }
3452 protected string ProtInst
3454 get { return null; }
3457 protected internal string ProIntInst
3459 get { return null; }
3466 if (PrivInst == null)
3468 return long.MaxValue;
3472 internal int IntInst
3477 private static string PrivStat
3479 get { return null; }
3482 protected static string ProtStat
3484 get { return null; }
3487 protected static internal string ProIntStat
3489 get { return null; }
3492 public static long PubStat
3496 if (PrivStat == null)
3498 return long.MaxValue;
3502 internal static int IntStat
3528 public CtorsC (int x)
3535 class UserType : Type
3537 protected Type type;
3539 public UserType(Type type) {
3543 public override Type UnderlyingSystemType { get { return this.type; } }
3545 public override Assembly Assembly { get { return this.type.Assembly; } }
3547 public override string AssemblyQualifiedName { get { return null; } }
3549 public override Type BaseType { get { return null; } }
3551 public override Module Module { get { return this.type.Module; } }
3553 public override string Namespace { get { return null; } }
3555 public override bool IsGenericParameter { get { return true; } }
3557 public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
3559 public override bool ContainsGenericParameters { get { return true; } }
3561 public override string FullName { get { return this.type.Name; } }
3563 public override Guid GUID { get { throw new NotSupportedException(); } }
3566 protected override bool IsArrayImpl() {
3570 protected override bool IsByRefImpl()
3575 protected override bool IsCOMObjectImpl()
3580 protected override bool IsPointerImpl()
3585 protected override bool IsPrimitiveImpl()
3591 protected override TypeAttributes GetAttributeFlagsImpl()
3596 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
3597 CallingConventions callConvention, Type[] types,
3598 ParameterModifier[] modifiers)
3603 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
3608 public override Type GetElementType()
3613 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
3619 public override FieldInfo GetField(string name, BindingFlags bindingAttr)
3625 public override Type GetInterface(string name, bool ignoreCase)
3630 public override Type[] GetInterfaces()
3635 public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
3640 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
3645 public override object[] GetCustomAttributes(bool inherit)
3650 public override bool IsDefined(Type attributeType, bool inherit)
3655 public override string Name { get { return this.type.Name; } }
3657 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
3659 throw new NotImplementedException();
3662 public override FieldInfo[] GetFields(BindingFlags bindingAttr)
3664 throw new NotImplementedException();
3667 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
3668 CallingConventions callConvention, Type[] types,
3669 ParameterModifier[] modifiers)
3674 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
3679 public override Type GetNestedType(string name, BindingFlags bindingAttr)
3684 public override Type[] GetNestedTypes(BindingFlags bindingAttr)
3689 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
3694 protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder,
3695 Type returnType, Type[] types, ParameterModifier[] modifiers)
3700 protected override bool HasElementTypeImpl()
3705 public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target,
3706 object[] args, ParameterModifier[] modifiers, CultureInfo culture,
3707 string[] namedParameters)
3709 throw new NotSupportedException();
3713 class UserType2 : UserType {
3714 public UserType2 (Type type) : base (type) {
3717 public override Type UnderlyingSystemType { get { return this.type ?? this; } }
3719 public override int GetHashCode()
3723 return type.GetHashCode();