1 // TypeTest.cs - NUnit Test Cases for the System.Type class
4 // Zoltan Varga (vargaz@freemail.hu)
6 // Aleksey Kliger (aleksey@xamarin.com)
8 // (C) 2003 Ximian, Inc. http://www.ximian.com
9 // Copyright (C) 2015 Xamarin, Inc. (http://www.xamarin.com)
12 using NUnit.Framework;
14 using System.Threading;
15 using System.Collections;
16 using System.Collections.Generic;
18 using System.Reflection;
19 #if !MONOTOUCH && !FULL_AOT_RUNTIME
20 using System.Reflection.Emit;
22 using System.Runtime.InteropServices;
24 using System.Globalization;
26 class NoNamespaceClass {
29 namespace MonoTests.System
31 class Super : ICloneable
33 public virtual object Clone ()
48 interface IFace2 : IFace1
53 interface IFace3 : IFace2
68 public abstract int this [byte i] {
72 public abstract int this [int i] {
76 public abstract void TestVoid ();
77 public abstract void TestInt (int i);
80 class DeriveVTable : Base
82 public override int this [byte i] {
86 public override int this [int i] {
90 public override void TestVoid ()
95 public override void TestInt (int i)
101 class NewVTable : DeriveVTable
103 public new int this [byte i] {
107 public new int this [int i] {
111 public new void TestVoid ()
116 public new void TestInt (int i)
121 public void Overload ()
125 public void Overload (int i)
129 public NewVTable (out int i)
134 public void byref_method (out int i)
142 public virtual int Foo {
147 public event EventHandler E;
154 class Derived1 : Base1
156 public override int Foo {
161 class Derived2 : Base1
168 public new event Action E;
169 public new void Dummy ()
180 get { throw new NotImplementedException (); }
183 public T Execute (T a)
188 public class Nested<K> {}
195 public interface IBar<T>
199 public class Baz<T> : IBar<T>
205 public static void Bang<S> () {}
208 public class Bug348522
210 public void Test (int __argument)
215 public class GenericIndexers<T, U>
217 // This class has two indexers that take different
218 // arguments. GetProperties on all instances of this
219 // generic type should still have 2 properties, even
220 // if T and U are instantiated with the same types.
221 public T this[T t] { get { return t; } }
222 public U this[U u] { get { return u; } }
225 public class FirstMethodBinder : Binder
227 public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase [] match, ref object [] args,
228 ParameterModifier [] modifiers, CultureInfo culture, string [] names,
235 public override object ChangeType (object value, Type type1, CultureInfo culture)
240 // The rest is just to please the compiler
241 public override FieldInfo BindToField (BindingFlags a, FieldInfo[] b, object c, CultureInfo d)
246 public override void ReorderArgumentArray(ref object[] a, object b)
250 public override MethodBase SelectMethod(BindingFlags a, MethodBase[] b, Type[] c, ParameterModifier[] d)
255 public override PropertyInfo SelectProperty(BindingFlags a, PropertyInfo[] b, Type c, Type[] d, ParameterModifier[] e)
262 public class TypeTest
264 #if !MONOTOUCH && !FULL_AOT_RUNTIME
265 private ModuleBuilder module;
267 const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
268 static int typeIndexer = 0;
269 static bool isMono = Type.GetType ("Mono.Runtime", false) != null;
274 AssemblyName assemblyName = new AssemblyName ();
275 assemblyName.Name = ASSEMBLY_NAME;
276 #if !MONOTOUCH && !FULL_AOT_RUNTIME
277 var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
278 assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
279 module = assembly.DefineDynamicModule ("module1");
283 private string genTypeName ()
285 return "t" + (typeIndexer++);
288 private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k)
292 public interface IFace {
295 private void GenericMethod<Q, T1> (Q q, T1 t) where T1 : IFace
305 public void TestIsAssignableFrom ()
307 // Simple tests for inheritance
308 Assert.AreEqual (typeof (Super).IsAssignableFrom (typeof (Duper)) , true, "#01");
309 Assert.AreEqual (typeof (Duper).IsAssignableFrom (typeof (Duper)), true, "#02");
310 Assert.AreEqual (typeof (Object).IsAssignableFrom (typeof (Duper)), true, "#03");
311 Assert.AreEqual (typeof (ICloneable).IsAssignableFrom (typeof (Duper)), true, "#04");
314 Assert.AreEqual (typeof (Super[]).IsAssignableFrom (typeof (Duper[])), true, "#05");
315 Assert.AreEqual (typeof (Duper[]).IsAssignableFrom (typeof (Super[])), false, "#06");
316 Assert.AreEqual (typeof (Object[]).IsAssignableFrom (typeof (Duper[])), true, "#07");
317 Assert.AreEqual (typeof (ICloneable[]).IsAssignableFrom (typeof (Duper[])), true, "#08");
319 // Tests for multiple dimensional arrays
320 Assert.AreEqual (typeof (Super[][]).IsAssignableFrom (typeof (Duper[][])), true, "#09");
321 Assert.AreEqual (typeof (Duper[][]).IsAssignableFrom (typeof (Super[][])), false, "#10");
322 Assert.AreEqual (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])), true, "#11");
323 Assert.AreEqual (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])), true, "#12");
325 // Tests for vectors<->one dimensional arrays */
326 Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
327 Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
329 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
330 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false, "#14");
332 // Test that arrays of enums can be cast to their base types
333 Assert.AreEqual (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])), true, "#15");
335 // Test that arrays of valuetypes can't be cast to arrays of
337 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TypeCode[])), false, "#16");
338 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TypeCode[])), false, "#17");
339 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TypeCode[])), false, "#18");
341 // Test that arrays of enums can't be cast to arrays of references
342 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TheEnum[])), false, "#19");
343 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TheEnum[])), false, "#20");
344 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TheEnum[])), false, "#21");
346 // Check that ValueType and Enum are recognized as reference types
347 Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (ValueType)), true, "#22");
348 Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (Enum)), true, "#23");
349 Assert.AreEqual (typeof (ValueType).IsAssignableFrom (typeof (Enum)), true, "#24");
351 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (ValueType[])), true, "#25");
352 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (ValueType[])), true, "#26");
353 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (ValueType[])), false, "#27");
355 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (Enum[])), true, "#28");
356 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (Enum[])), true, "#29");
357 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (Enum[])), true, "#30");
359 // Tests for byref types
360 MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
361 Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
362 Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
364 // Tests for type parameters
365 mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
366 Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
367 Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
369 // Tests for parameters with generic constraints
370 mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
371 Assert.IsTrue (typeof (IFace).IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
375 [ExpectedException (typeof (ArgumentException))]
376 public void GetInterfaceMapOnInterface ()
378 typeof (IList).GetInterfaceMap (typeof (ICollection));
382 public void TestIsSubclassOf ()
384 Assert.IsTrue (typeof (ICloneable).IsSubclassOf (typeof (object)), "#01");
386 // Tests for byref types
387 Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
388 Assert.IsFalse (paramType.IsSubclassOf (typeof(ValueType)), "#02");
389 Assert.IsNull (paramType.BaseType, "#02-b");
390 Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
391 Assert.IsFalse (paramType.IsSubclassOf (paramType), "#04");
395 public void TestGetMethodImpl ()
397 // Test binding of new slot methods (using no types)
398 Assert.AreEqual (typeof (Base), typeof (Base).GetMethod("TestVoid").DeclaringType, "#01");
399 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestVoid").DeclaringType, "#02");
401 // Test binding of new slot methods (using types)
402 Assert.AreEqual (typeof (Base), typeof (Base).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#03");
403 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#04");
405 // Test overload resolution
406 Assert.AreEqual (0, typeof (NewVTable).GetMethod ("Overload", new Type[0]).GetParameters ().Length, "#05");
408 // Test byref parameters
409 Assert.AreEqual (null, typeof (NewVTable).GetMethod ("byref_method", new Type[] { typeof (int) }), "#06");
410 Type byrefInt = typeof (NewVTable).GetMethod ("byref_method").GetParameters ()[0].ParameterType;
411 Assert.IsNotNull (typeof (NewVTable).GetMethod ("byref_method", new Type[] { byrefInt }), "#07");
415 public void TestGetPropertyImpl ()
417 // Test getting property that is exact
418 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int32) }).DeclaringType, "#01");
420 // Test getting property that is not exact
421 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int16) }).DeclaringType, "#02");
423 // Test overriding of properties when only the set accessor is overriden
424 Assert.AreEqual (1, typeof (Derived1).GetProperties ().Length, "#03");
428 public void GetEvents ()
431 Assert.AreEqual (1, typeof (Derived2).GetEvents ().Length);
432 Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetEvents ()[0].DeclaringType);
436 public void GetProperties ()
438 // Test hide-by-name-and-signature
439 Assert.AreEqual (1, typeof (Derived2).GetProperties ().Length, "#1");
440 Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetProperties ()[0].DeclaringType, "#2");
442 // For generics, hide-by-name-and-signature works on the unexpanded types. The
443 // GenericIndexers<T,U> class has two indexers that take different arguments.
444 // GetProperties on all instances of this generic type should still have 2 properties,
445 // even if T and U are instantiated with the same types.
447 var ps = typeof (GenericIndexers<int,int>).GetProperties ();
448 Assert.AreEqual (2, ps.Length, "#3");
449 for (int i = 0; i < ps.Length; i++) {
452 var getterResultType = p.GetGetMethod ().ReturnType;
454 var msg = String.Format ("#4-{0}", i);
455 Assert.AreEqual (typeof (int), getterResultType, msg);
460 class GetProperties_Overrides_Input
462 public class TestClass : BaseClass<object>
464 public override object TestProperty { get; set; }
467 public abstract class BaseClass<T>
469 public virtual T TestProperty { get; set; }
472 public class TestClass_Indexer : BaseClass_Indexer<object>
474 public override object this[int arg] { set { } }
477 public abstract class BaseClass_Indexer<T>
479 public virtual T this[int arg] { set { } }
482 public interface IB : IA<object>
484 new object TestProperty { get; set; }
487 public interface IA<T>
489 T TestProperty { get; set; }
492 public class TestClass_HiddenProperty : BaseClass_HiddenProperty
494 public new virtual string Prop { set { } }
497 public class BaseClass_HiddenProperty
499 public virtual string Prop { set { } }
504 public void GetProperties_Overrides ()
506 Assert.AreEqual (1, typeof (GetProperties_Overrides_Input.IB).GetProperties().Length);
508 var prop = typeof (GetProperties_Overrides_Input.TestClass).GetProperty ("TestProperty");
509 Assert.AreEqual (typeof (GetProperties_Overrides_Input.TestClass), prop.DeclaringType);
511 var prop_2 = typeof (GetProperties_Overrides_Input.TestClass_HiddenProperty).GetProperty ("Prop");
512 Assert.AreEqual (typeof (GetProperties_Overrides_Input.TestClass_HiddenProperty), prop_2.DeclaringType);
514 Assert.AreEqual (1, typeof (GetProperties_Overrides_Input.TestClass).GetProperties().Length);
515 Assert.AreEqual (1, typeof (GetProperties_Overrides_Input.TestClass_Indexer).GetProperties().Length);
516 Assert.AreEqual (1, typeof (GetProperties_Overrides_Input.TestClass_HiddenProperty).GetProperties().Length);
519 [Test] // GetProperties (BindingFlags)
520 public void GetProperties_Flags ()
522 PropertyInfo [] props;
523 Type type = typeof (Bar);
526 flags = BindingFlags.Instance | BindingFlags.NonPublic;
527 props = type.GetProperties (flags);
529 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#A1");
530 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#A2");
531 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#A3");
532 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#A4");
533 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#A5");
534 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#A6");
535 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#A7");
536 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#A8");
537 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#A9");
538 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#A10");
539 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#A11");
540 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#A12");
541 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#A13");
542 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#A14");
543 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#A15");
544 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#A16");
545 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#A17");
546 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#A18");
547 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#A19");
548 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#A20");
549 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#A21");
550 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#A22");
551 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#A23");
552 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#A24");
553 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#A25");
554 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#A26");
555 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#A27");
556 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#A28");
557 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#A29");
558 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#A30");
560 flags = BindingFlags.Instance | BindingFlags.Public;
561 props = type.GetProperties (flags);
563 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#B1");
564 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#B2");
565 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#B3");
566 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#B4");
567 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#B5");
568 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#B6");
569 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#B7");
570 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#B8");
571 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#B9");
572 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#B10");
573 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#B11");
574 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#B12");
575 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#B13");
576 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#B14");
577 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#B15");
578 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#B16");
579 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#B17");
580 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#B18");
581 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#B19");
582 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#B20");
583 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#B21");
584 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#B22");
585 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#B23");
586 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#B24");
587 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#B25");
588 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#B26");
589 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#B27");
590 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#B28");
591 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#B29");
592 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#B30");
594 flags = BindingFlags.Static | BindingFlags.Public;
595 props = type.GetProperties (flags);
597 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#C1");
598 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#C2");
599 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#C3");
600 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#C4");
601 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#C5");
602 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#C6");
603 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#C7");
604 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#C8");
605 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#C9");
606 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#C10");
607 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#C11");
608 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#C12");
609 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#C13");
610 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#C14");
611 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#C15");
612 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#C16");
613 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#C17");
614 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#C18");
615 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#C19");
616 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#C20");
617 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#C21");
618 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#C22");
619 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#C23");
620 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#C24");
621 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#C25");
622 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#C26");
623 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#C27");
624 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#C28");
625 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#C29");
626 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#C30");
628 flags = BindingFlags.Static | BindingFlags.NonPublic;
629 props = type.GetProperties (flags);
631 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#D1");
632 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#D2");
633 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#D3");
634 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#D4");
635 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#D5");
636 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#D6");
637 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#D7");
638 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#D8");
639 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#D9");
640 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#D10");
641 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#D11");
642 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#D12");
643 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#D13");
644 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#D14");
645 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#D15");
646 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#D16");
647 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#D17");
648 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#D18");
649 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#D19");
650 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#D20");
651 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#D21");
652 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#D22");
653 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#D23");
654 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#D24");
655 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#D25");
656 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#D26");
657 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#D27");
658 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#D28");
659 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#D29");
660 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#D30");
662 flags = BindingFlags.Instance | BindingFlags.NonPublic |
663 BindingFlags.FlattenHierarchy;
664 props = type.GetProperties (flags);
666 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#E1");
667 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#E2");
668 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#E3");
669 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#E4");
670 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#E5");
671 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#E6");
672 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#E7");
673 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#E8");
674 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#E9");
675 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#E10");
676 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#E11");
677 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#E12");
678 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#E13");
679 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#E14");
680 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#E15");
681 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#E16");
682 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#E17");
683 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#E18");
684 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#E19");
685 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#E20");
686 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#E21");
687 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#E22");
688 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#E23");
689 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#E24");
690 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#E25");
691 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#E26");
692 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#E27");
693 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#E28");
694 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#E29");
695 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#E30");
697 flags = BindingFlags.Instance | BindingFlags.Public |
698 BindingFlags.FlattenHierarchy;
699 props = type.GetProperties (flags);
701 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#F1");
702 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#F2");
703 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#F3");
704 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#F4");
705 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#F5");
706 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#F6");
707 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#F7");
708 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#F8");
709 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#F9");
710 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#F10");
711 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#F11");
712 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#F12");
713 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#F13");
714 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#F14");
715 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#F15");
716 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#F16");
717 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#F17");
718 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#F18");
719 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#F19");
720 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#F20");
721 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#F21");
722 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#F22");
723 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#F23");
724 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#F24");
725 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#F25");
726 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#F26");
727 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#F27");
728 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#F28");
729 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#F29");
730 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#F30");
732 flags = BindingFlags.Static | BindingFlags.Public |
733 BindingFlags.FlattenHierarchy;
734 props = type.GetProperties (flags);
736 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#G1");
737 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#G2");
738 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#G3");
739 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#G4");
740 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#G5");
741 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#G6");
742 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#G7");
743 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#G8");
744 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#G9");
745 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#G10");
746 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#G11");
747 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#G12");
748 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#G13");
749 Assert.IsTrue (ContainsProperty (props, "PubStatBase"), "#G14");
750 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#G15");
751 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#G16");
752 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#G17");
753 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#G18");
754 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#G19");
755 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#G20");
756 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#G21");
757 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#G22");
758 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#G23");
759 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#G24");
760 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#G25");
761 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#G26");
762 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#G27");
763 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#G28");
764 Assert.IsTrue (ContainsProperty (props, "PubStatBlue"), "#G29");
765 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#G30");
767 flags = BindingFlags.Static | BindingFlags.NonPublic |
768 BindingFlags.FlattenHierarchy;
769 props = type.GetProperties (flags);
771 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#H1");
772 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#H2");
773 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#H3");
774 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#H4");
775 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#H5");
776 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#H6");
777 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#H7");
778 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#H8");
779 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#H9");
780 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#H10");
781 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#H11");
782 Assert.IsTrue (ContainsProperty (props, "ProtStatBase"), "#H12");
783 Assert.IsTrue (ContainsProperty (props, "ProIntStatBase"), "#H13");
784 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#H14");
785 Assert.IsTrue (ContainsProperty (props, "IntStatBase"), "#H15");
786 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#H16");
787 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#H17");
788 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#H18");
789 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#H19");
790 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#H20");
791 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#H21");
792 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#H22");
793 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#H23");
794 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#H24");
795 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#H25");
796 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#H26");
797 Assert.IsTrue (ContainsProperty (props, "ProtStatBlue"), "#H27");
798 Assert.IsTrue (ContainsProperty (props, "ProIntStatBlue"), "#H28");
799 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#H29");
800 Assert.IsTrue (ContainsProperty (props, "IntStatBlue"), "#H30");
802 flags = BindingFlags.Instance | BindingFlags.NonPublic |
803 BindingFlags.DeclaredOnly;
804 props = type.GetProperties (flags);
806 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#I1");
807 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#I2");
808 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#I3");
809 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#I4");
810 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#I5");
811 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#I6");
812 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#I7");
813 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#I8");
814 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#I9");
815 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#I10");
816 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#I11");
817 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#I12");
818 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#I13");
819 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#I14");
820 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#I15");
821 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#I16");
822 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#I17");
823 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#I18");
824 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#I19");
825 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#I20");
826 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#I21");
827 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#I22");
828 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#I23");
829 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#I24");
830 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#I25");
831 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#I26");
832 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#I27");
833 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#I28");
834 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#I29");
835 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#I30");
837 flags = BindingFlags.Instance | BindingFlags.Public |
838 BindingFlags.DeclaredOnly;
839 props = type.GetProperties (flags);
841 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#J1");
842 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#J2");
843 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#J3");
844 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#J4");
845 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#J5");
846 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#J6");
847 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#J7");
848 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#J8");
849 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#J9");
850 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#J10");
851 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#J11");
852 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#J12");
853 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#J13");
854 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#J14");
855 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#J15");
856 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#J16");
857 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#J17");
858 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#J18");
859 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#J19");
860 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#J20");
861 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#J21");
862 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#J22");
863 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#J23");
864 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#J24");
865 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#J25");
866 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#J26");
867 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#J27");
868 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#J28");
869 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#J29");
870 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#J30");
872 flags = BindingFlags.Static | BindingFlags.Public |
873 BindingFlags.DeclaredOnly;
874 props = type.GetProperties (flags);
876 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#K1");
877 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#K2");
878 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#K3");
879 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#K4");
880 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#K5");
881 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#K6");
882 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#K7");
883 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#K8");
884 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#K9");
885 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#K10");
886 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#K11");
887 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#K12");
888 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#K13");
889 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#K14");
890 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#K15");
891 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#K16");
892 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#K17");
893 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#K18");
894 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#K19");
895 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#K20");
896 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#K21");
897 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#K22");
898 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#K23");
899 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#K24");
900 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#K25");
901 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#K26");
902 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#K27");
903 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#K28");
904 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#K29");
905 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#K30");
907 flags = BindingFlags.Static | BindingFlags.NonPublic |
908 BindingFlags.DeclaredOnly;
909 props = type.GetProperties (flags);
911 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#L1");
912 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#L2");
913 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#L3");
914 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#L4");
915 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#L5");
916 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#L6");
917 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#L7");
918 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#L8");
919 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#L9");
920 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#L10");
921 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#L11");
922 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#L12");
923 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#L13");
924 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#L14");
925 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#L15");
926 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#L16");
927 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#L17");
928 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#L18");
929 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#L19");
930 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#L20");
931 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#L21");
932 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#L22");
933 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#L23");
934 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#L24");
935 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#L25");
936 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#L26");
937 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#L27");
938 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#L28");
939 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#L29");
940 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#L30");
942 flags = BindingFlags.Instance | BindingFlags.NonPublic |
944 props = type.GetProperties (flags);
946 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#M1");
947 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#M2");
948 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#M3");
949 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#M4");
950 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#M5");
951 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#M6");
952 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#M7");
953 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#M8");
954 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#M9");
955 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#M10");
956 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#M11");
957 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#M12");
958 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#M13");
959 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#M14");
960 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#M15");
961 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#M16");
962 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#M17");
963 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#M18");
964 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#M19");
965 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#M20");
966 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#M21");
967 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#M22");
968 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#M23");
969 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#M24");
970 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#M25");
971 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#M26");
972 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#M27");
973 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#M28");
974 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#M29");
975 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#M30");
977 flags = BindingFlags.Static | BindingFlags.NonPublic |
979 props = type.GetProperties (flags);
981 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#N1");
982 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#N2");
983 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#N3");
984 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#N4");
985 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#N5");
986 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#N6");
987 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#N7");
988 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#N8");
989 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#N9");
990 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#N10");
991 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#N11");
992 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#N12");
993 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#N13");
994 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#N14");
995 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#N15");
996 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#N16");
997 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#N17");
998 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#N18");
999 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#N19");
1000 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#N20");
1001 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#N21");
1002 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#N22");
1003 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#N23");
1004 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#N24");
1005 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#N25");
1006 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#N26");
1007 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#N27");
1008 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#N28");
1009 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#N29");
1010 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#N30");
1013 [Test] // GetProperty (String)
1014 public void GetProperty1_Name_Null ()
1016 Type type = typeof (Bar);
1018 type.GetProperty ((string) null);
1020 } catch (ArgumentNullException ex) {
1021 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1022 Assert.IsNull (ex.InnerException, "#3");
1023 Assert.IsNotNull (ex.Message, "#4");
1024 Assert.IsNotNull (ex.ParamName, "#5");
1025 Assert.AreEqual ("name", ex.ParamName, "#6");
1029 [Test] // GetProperty (String, BindingFlags)
1030 public void GetProperty2 ()
1032 Type type = typeof (Bar);
1035 flags = BindingFlags.Instance | BindingFlags.NonPublic;
1037 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#A1");
1038 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#A2");
1039 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#A3");
1040 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#A4");
1041 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#A5");
1042 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#A6");
1043 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#A7");
1044 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#A8");
1045 Assert.IsNull (type.GetProperty ("PubInst", flags), "#A9");
1046 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#A10");
1047 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#A11");
1048 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#A12");
1049 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#A13");
1050 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#A14");
1051 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#A15");
1052 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#A16");
1053 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#A17");
1054 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#A18");
1055 Assert.IsNull (type.GetProperty ("PubStat", flags), "#A19");
1056 Assert.IsNull (type.GetProperty ("IntStat", flags), "#A20");
1057 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#A21");
1058 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#A22");
1059 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#A23");
1060 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#A24");
1061 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#A25");
1062 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#A26");
1063 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#A27");
1064 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#A28");
1065 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#A29");
1066 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#A30");
1068 flags = BindingFlags.Instance | BindingFlags.Public;
1070 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#B1");
1071 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#B2");
1072 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#B3");
1073 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#B4");
1074 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#B5");
1075 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#B6");
1076 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#B7");
1077 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#B8");
1078 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#B9");
1079 Assert.IsNull (type.GetProperty ("IntInst", flags), "#B10");
1080 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#B11");
1081 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#B12");
1082 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#B13");
1083 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#B14");
1084 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#B15");
1085 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#B16");
1086 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#B17");
1087 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#B18");
1088 Assert.IsNull (type.GetProperty ("PubStat", flags), "#B19");
1089 Assert.IsNull (type.GetProperty ("IntStat", flags), "#B20");
1090 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#B21");
1091 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#B22");
1092 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#B23");
1093 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#B24");
1094 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#B25");
1095 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#B26");
1096 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#B27");
1097 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#B28");
1098 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#B29");
1099 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#B30");
1101 flags = BindingFlags.Static | BindingFlags.Public;
1103 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#C1");
1104 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#C2");
1105 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#C3");
1106 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#C4");
1107 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#C5");
1108 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#C6");
1109 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#C7");
1110 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#C8");
1111 Assert.IsNull (type.GetProperty ("PubInst", flags), "#C9");
1112 Assert.IsNull (type.GetProperty ("IntInst", flags), "#C10");
1113 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#C11");
1114 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#C12");
1115 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#C13");
1116 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#C14");
1117 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#C15");
1118 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#C16");
1119 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#C17");
1120 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#C18");
1121 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#C19");
1122 Assert.IsNull (type.GetProperty ("IntStat", flags), "#C20");
1123 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#C21");
1124 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#C22");
1125 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#C23");
1126 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#C24");
1127 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#C25");
1128 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#C26");
1129 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#C27");
1130 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#C28");
1131 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#C29");
1132 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#C30");
1134 flags = BindingFlags.Static | BindingFlags.NonPublic;
1136 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#D1");
1137 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#D2");
1138 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#D3");
1139 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#D4");
1140 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#D5");
1141 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#D6");
1142 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#D7");
1143 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#D8");
1144 Assert.IsNull (type.GetProperty ("PubInst", flags), "#D9");
1145 Assert.IsNull (type.GetProperty ("IntInst", flags), "#D10");
1146 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#D11");
1147 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#D12");
1148 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#D13");
1149 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#D14");
1150 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#D15");
1151 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#D16");
1152 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#D17");
1153 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#D18");
1154 Assert.IsNull (type.GetProperty ("PubStat", flags), "#D19");
1155 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#D20");
1156 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#D21");
1157 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#D22");
1158 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#D23");
1159 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#D24");
1160 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#D25");
1161 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#D26");
1162 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#D27");
1163 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#D28");
1164 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#D29");
1165 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#D30");
1167 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1168 BindingFlags.FlattenHierarchy;
1170 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#E1");
1171 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#E2");
1172 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#E3");
1173 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#E4");
1174 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#E5");
1175 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#E6");
1176 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#E7");
1177 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#E8");
1178 Assert.IsNull (type.GetProperty ("PubInst", flags), "#E9");
1179 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#E10");
1180 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#E11");
1181 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#E12");
1182 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#E13");
1183 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#E14");
1184 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#E15");
1185 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#E16");
1186 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#E17");
1187 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#E18");
1188 Assert.IsNull (type.GetProperty ("PubStat", flags), "#E19");
1189 Assert.IsNull (type.GetProperty ("IntStat", flags), "#E20");
1190 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#E21");
1191 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#E22");
1192 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#E23");
1193 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#E24");
1194 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1195 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#E26");
1196 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#E27");
1197 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#E28");
1198 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#E29");
1199 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#E30");
1201 flags = BindingFlags.Instance | BindingFlags.Public |
1202 BindingFlags.FlattenHierarchy;
1204 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#F1");
1205 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#F2");
1206 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#F3");
1207 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#F4");
1208 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#F5");
1209 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#F6");
1210 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#F7");
1211 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#F8");
1212 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#F9");
1213 Assert.IsNull (type.GetProperty ("IntInst", flags), "#F10");
1214 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#F11");
1215 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#F12");
1216 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#F13");
1217 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#F14");
1218 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#F15");
1219 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#F16");
1220 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#F17");
1221 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#F18");
1222 Assert.IsNull (type.GetProperty ("PubStat", flags), "#F19");
1223 Assert.IsNull (type.GetProperty ("IntStat", flags), "#F20");
1224 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#F21");
1225 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#F22");
1226 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#F23");
1227 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#F24");
1228 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#F25");
1229 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#F26");
1230 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#F27");
1231 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#F28");
1232 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#F29");
1233 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#F30");
1235 flags = BindingFlags.Static | BindingFlags.Public |
1236 BindingFlags.FlattenHierarchy;
1238 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#G1");
1239 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#G2");
1240 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#G3");
1241 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#G4");
1242 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#G5");
1243 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#G6");
1244 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#G7");
1245 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#G8");
1246 Assert.IsNull (type.GetProperty ("PubInst", flags), "#G9");
1247 Assert.IsNull (type.GetProperty ("IntInst", flags), "#G10");
1248 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#G11");
1249 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#G12");
1250 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#G13");
1251 Assert.IsNotNull (type.GetProperty ("PubStatBase", flags), "#G14");
1252 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#G15");
1253 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#G16");
1254 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#G17");
1255 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#G18");
1256 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#G19");
1257 Assert.IsNull (type.GetProperty ("IntStat", flags), "#G20");
1258 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#G21");
1259 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#G22");
1260 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#G23");
1261 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#G24");
1262 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#G25");
1263 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#G26");
1264 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#G27");
1265 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#G28");
1266 Assert.IsNotNull (type.GetProperty ("PubStatBlue", flags), "#G29");
1267 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#G30");
1269 flags = BindingFlags.Static | BindingFlags.NonPublic |
1270 BindingFlags.FlattenHierarchy;
1272 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#H1");
1273 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#H2");
1274 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#H3");
1275 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#H4");
1276 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#H5");
1277 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#H6");
1278 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#H7");
1279 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#H8");
1280 Assert.IsNull (type.GetProperty ("PubInst", flags), "#H9");
1281 Assert.IsNull (type.GetProperty ("IntInst", flags), "#H10");
1282 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#H11");
1283 Assert.IsNotNull (type.GetProperty ("ProtStatBase", flags), "#H12");
1284 Assert.IsNotNull (type.GetProperty ("ProIntStatBase", flags), "#H13");
1285 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#H14");
1286 Assert.IsNotNull (type.GetProperty ("IntStatBase", flags), "#H15");
1287 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#H16");
1288 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#H17");
1289 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#H18");
1290 Assert.IsNull (type.GetProperty ("PubStat", flags), "#H19");
1291 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#H20");
1292 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#H21");
1293 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#H22");
1294 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#H23");
1295 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#H24");
1296 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#H25");
1297 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#H26");
1298 Assert.IsNotNull (type.GetProperty ("ProtStatBlue", flags), "#H27");
1299 Assert.IsNotNull (type.GetProperty ("ProIntStatBlue", flags), "#H28");
1300 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#H29");
1301 Assert.IsNotNull (type.GetProperty ("IntStatBlue", flags), "#H30");
1303 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1304 BindingFlags.DeclaredOnly;
1306 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#I1");
1307 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#I2");
1308 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#I3");
1309 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#I4");
1310 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#I5");
1311 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#I6");
1312 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#I7");
1313 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#I8");
1314 Assert.IsNull (type.GetProperty ("PubInst", flags), "#I9");
1315 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#I10");
1316 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#I11");
1317 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#I12");
1318 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#I13");
1319 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#I14");
1320 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#I15");
1321 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#I16");
1322 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#I17");
1323 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#I18");
1324 Assert.IsNull (type.GetProperty ("PubStat", flags), "#I19");
1325 Assert.IsNull (type.GetProperty ("IntStat", flags), "#I20");
1326 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#I21");
1327 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#I22");
1328 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#I23");
1329 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#I24");
1330 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#I25");
1331 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#I26");
1332 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#I27");
1333 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#I28");
1334 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#I29");
1335 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#I30");
1337 flags = BindingFlags.Instance | BindingFlags.Public |
1338 BindingFlags.DeclaredOnly;
1340 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#J1");
1341 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#J2");
1342 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#J3");
1343 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#J4");
1344 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#J5");
1345 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#J6");
1346 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#J7");
1347 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#J8");
1348 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#J9");
1349 Assert.IsNull (type.GetProperty ("IntInst", flags), "#J10");
1350 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#J11");
1351 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#J12");
1352 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#J13");
1353 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#J14");
1354 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#J15");
1355 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#J16");
1356 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#J17");
1357 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#J18");
1358 Assert.IsNull (type.GetProperty ("PubStat", flags), "#J19");
1359 Assert.IsNull (type.GetProperty ("IntStat", flags), "#J20");
1360 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#J21");
1361 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#J22");
1362 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#J23");
1363 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#J24");
1364 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#J25");
1365 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#J26");
1366 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#J27");
1367 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#J28");
1368 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#J29");
1369 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#J30");
1371 flags = BindingFlags.Static | BindingFlags.Public |
1372 BindingFlags.DeclaredOnly;
1374 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#K1");
1375 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#K2");
1376 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#K3");
1377 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#K4");
1378 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#K5");
1379 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#K6");
1380 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#K7");
1381 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#K8");
1382 Assert.IsNull (type.GetProperty ("PubInst", flags), "#K9");
1383 Assert.IsNull (type.GetProperty ("IntInst", flags), "#K10");
1384 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#K11");
1385 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#K12");
1386 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#K13");
1387 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#K14");
1388 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#K15");
1389 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#K16");
1390 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#K17");
1391 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#K18");
1392 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#K19");
1393 Assert.IsNull (type.GetProperty ("IntStat", flags), "#K20");
1394 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#K21");
1395 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#K22");
1396 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#K23");
1397 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#K24");
1398 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#K25");
1399 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#K26");
1400 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#K27");
1401 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#K28");
1402 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#K29");
1403 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#K30");
1405 flags = BindingFlags.Static | BindingFlags.NonPublic |
1406 BindingFlags.DeclaredOnly;
1408 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#L1");
1409 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#L2");
1410 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#L3");
1411 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#L4");
1412 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#L5");
1413 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#L6");
1414 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#L7");
1415 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#L8");
1416 Assert.IsNull (type.GetProperty ("PubInst", flags), "#L9");
1417 Assert.IsNull (type.GetProperty ("IntInst", flags), "#L10");
1418 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#L11");
1419 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#L12");
1420 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#L13");
1421 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#L14");
1422 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#L15");
1423 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#L16");
1424 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#L17");
1425 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#L18");
1426 Assert.IsNull (type.GetProperty ("PubStat", flags), "#L19");
1427 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#L20");
1428 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#L21");
1429 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#L22");
1430 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#L23");
1431 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#L24");
1432 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#L25");
1433 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#L26");
1434 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#L27");
1435 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#L28");
1436 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#L29");
1437 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#L30");
1439 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1440 BindingFlags.Public;
1442 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#M1");
1443 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#M2");
1444 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#M3");
1445 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#M4");
1446 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#M5");
1447 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#M6");
1448 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#M7");
1449 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#M8");
1450 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#M9");
1451 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#M10");
1452 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#M11");
1453 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#M12");
1454 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#M13");
1455 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#M14");
1456 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#M15");
1457 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#M16");
1458 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#M17");
1459 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#M18");
1460 Assert.IsNull (type.GetProperty ("PubStat", flags), "#M19");
1461 Assert.IsNull (type.GetProperty ("IntStat", flags), "#M20");
1462 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#M21");
1463 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#M22");
1464 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#M23");
1465 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#M24");
1466 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1467 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#M26");
1468 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#M27");
1469 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#M28");
1470 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#M29");
1471 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#M30");
1473 flags = BindingFlags.Static | BindingFlags.NonPublic |
1474 BindingFlags.Public;
1476 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#N1");
1477 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#N2");
1478 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#N3");
1479 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#N4");
1480 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#N5");
1481 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#N6");
1482 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#N7");
1483 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#N8");
1484 Assert.IsNull (type.GetProperty ("PubInst", flags), "#N9");
1485 Assert.IsNull (type.GetProperty ("IntInst", flags), "#N10");
1486 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#N11");
1487 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#N12");
1488 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#N13");
1489 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#N14");
1490 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#N15");
1491 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#N16");
1492 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#N17");
1493 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#N18");
1494 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#N19");
1495 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#N20");
1496 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#N21");
1497 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#N22");
1498 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#N23");
1499 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#N24");
1500 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#N25");
1501 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#N26");
1502 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#N27");
1503 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#N28");
1504 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#N29");
1505 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#N30");
1508 [Test] // GetProperty (String, BindingFlags)
1509 public void GetProperty2_Name_Null ()
1511 Type type = typeof (Bar);
1513 type.GetProperty ((string) null);
1515 } catch (ArgumentNullException ex) {
1516 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1517 Assert.IsNull (ex.InnerException, "#3");
1518 Assert.IsNotNull (ex.Message, "#4");
1519 Assert.IsNotNull (ex.ParamName, "#5");
1520 Assert.AreEqual ("name", ex.ParamName, "#6");
1524 [Test] // GetProperty (String, Type)
1525 public void GetProperty3_Name_Null ()
1527 Type type = typeof (Bar);
1529 type.GetProperty ((string) null, typeof (int));
1531 } catch (ArgumentNullException ex) {
1532 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1533 Assert.IsNull (ex.InnerException, "#3");
1534 Assert.IsNotNull (ex.Message, "#4");
1535 Assert.IsNotNull (ex.ParamName, "#5");
1536 Assert.AreEqual ("name", ex.ParamName, "#6");
1540 [Test] // GetProperty (String, Type [])
1541 public void GetProperty4_Name_Null ()
1543 Type type = typeof (Bar);
1545 type.GetProperty ((string) null, Type.EmptyTypes);
1547 } catch (ArgumentNullException ex) {
1548 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1549 Assert.IsNull (ex.InnerException, "#3");
1550 Assert.IsNotNull (ex.Message, "#4");
1551 Assert.IsNotNull (ex.ParamName, "#5");
1552 Assert.AreEqual ("name", ex.ParamName, "#6");
1556 [Test] // GetProperty (String, Type, Type [])
1557 public void GetProperty5_Name_Null ()
1559 Type type = typeof (Bar);
1561 type.GetProperty ((string) null, typeof (int),
1564 } catch (ArgumentNullException ex) {
1565 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1566 Assert.IsNull (ex.InnerException, "#3");
1567 Assert.IsNotNull (ex.Message, "#4");
1568 Assert.IsNotNull (ex.ParamName, "#5");
1569 Assert.AreEqual ("name", ex.ParamName, "#6");
1573 [Test] // GetProperty (String, Type, Type [], ParameterModifier [])
1574 public void GetProperty6_Name_Null ()
1576 Type type = typeof (Bar);
1578 type.GetProperty ((string) null, typeof (int),
1579 Type.EmptyTypes, null);
1581 } catch (ArgumentNullException ex) {
1582 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1583 Assert.IsNull (ex.InnerException, "#3");
1584 Assert.IsNotNull (ex.Message, "#4");
1585 Assert.IsNotNull (ex.ParamName, "#5");
1586 Assert.AreEqual ("name", ex.ParamName, "#6");
1590 [Test] // GetProperty (String, BindingFlags, Binder, Type, Type [], ParameterModifier [])
1591 public void GetProperty7_Name_Null ()
1593 Type type = typeof (Bar);
1595 type.GetProperty ((string) null, BindingFlags.Public,
1596 null, typeof (int), Type.EmptyTypes, null);
1598 } catch (ArgumentNullException ex) {
1599 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1600 Assert.IsNull (ex.InnerException, "#3");
1601 Assert.IsNotNull (ex.Message, "#4");
1602 Assert.IsNotNull (ex.ParamName, "#5");
1603 Assert.AreEqual ("name", ex.ParamName, "#6");
1608 public void GetProperty8_PropertyType ()
1610 Type type = typeof (Bar);
1611 Assert.IsNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance,
1612 null, typeof (int), Type.EmptyTypes, null), "#1");
1613 Assert.IsNotNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance, null,
1614 typeof (long), new Type[0], null), "#2");
1618 public void GetProperty9_Indexers ()
1621 var bindingFlags = BindingFlags.Public | BindingFlags.Instance;
1623 Type type1 = typeof (List<byte>);
1624 var p1 = type1.GetProperty ("Item", bindingFlags, null, typeof (byte), new Type[] { typeof (int) }, null);
1625 Assert.IsNotNull (p1, "#1");
1627 Type type2 = typeof (List<string>);
1628 var p2 = type2.GetProperty ("Item", bindingFlags, null, typeof (string), new Type[] { typeof (int) }, null);
1629 Assert.IsNotNull (p2, "#2");
1631 Type type3 = typeof (List<Type>);
1632 // result type not convertible, make sure we fail.
1633 var p3 = type3.GetProperty ("Item", bindingFlags, null, typeof (string) /*!*/,
1634 new Type[] { typeof (int) }, null);
1635 Assert.IsNull (p3, "#3");
1638 [StructLayout(LayoutKind.Explicit, Pack = 4, Size = 64)]
1643 [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
1649 public void StructLayoutAttribute ()
1651 StructLayoutAttribute attr1 = typeof (TypeTest).StructLayoutAttribute;
1652 Assert.AreEqual (LayoutKind.Auto, attr1.Value);
1654 StructLayoutAttribute attr2 = typeof (Class1).StructLayoutAttribute;
1655 Assert.AreEqual (LayoutKind.Explicit, attr2.Value);
1656 Assert.AreEqual (4, attr2.Pack);
1657 Assert.AreEqual (64, attr2.Size);
1659 StructLayoutAttribute attr3 = typeof (Class2).StructLayoutAttribute;
1660 Assert.AreEqual (LayoutKind.Explicit, attr3.Value);
1661 Assert.AreEqual (CharSet.Unicode, attr3.CharSet);
1665 public void Namespace ()
1667 Assert.AreEqual (null, typeof (NoNamespaceClass).Namespace);
1671 public void GenericParameterNamespace ()
1673 var t = typeof (Foo<>).GetGenericArguments () [0];
1675 Assert.AreEqual ("T", t.Name);
1676 Assert.AreEqual ("MonoTests.System", t.Namespace);
1678 var s = typeof (Gazonk).GetMethod ("Bang").GetGenericArguments () [0];
1680 Assert.AreEqual ("S", s.Name);
1681 Assert.AreEqual ("MonoTests.System", s.Namespace);
1684 public static void Reflected (ref int a)
1691 Assert.AreEqual ("Int32&", typeof (TypeTest).GetMethod ("Reflected").GetParameters () [0].ParameterType.Name);
1692 Assert.AreEqual ("String[*]", Array.CreateInstance (typeof(string), new int[] { 1 }, new int[] { 1 }).GetType ().Name);
1696 public void GetInterfaces ()
1698 Type[] t = typeof (Duper).GetInterfaces ();
1699 Assert.AreEqual (1, t.Length);
1700 Assert.AreEqual (typeof (ICloneable), t[0]);
1702 Type[] t2 = typeof (IFace3).GetInterfaces ();
1703 Assert.AreEqual (2, t2.Length);
1707 public void GetInterfacesGenericVarWithConstraints ()
1709 var a = typeof (TypeTest).GetMethod ("GenericMethod");
1711 var p = a.GetParameters ();
1712 var i = p[0].ParameterType.GetElementType ();
1716 public static void GenericMethod<T, T2> (T[] arr) where T: IComparable<T> {
1722 public void GetFieldIgnoreCase ()
1724 Assert.IsNotNull (typeof (TypeTest).GetField ("afield", BindingFlags.Instance|BindingFlags.Public|BindingFlags.IgnoreCase));
1737 public void GetPropertyAccessorModifiers ()
1739 Assert.IsNotNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.Public));
1740 Assert.IsNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.NonPublic));
1744 public void IsAbstract ()
1746 Assert.IsFalse (typeof (string).IsAbstract, "#1");
1747 Assert.IsTrue (typeof (ICloneable).IsAbstract, "#2");
1748 Assert.IsTrue (typeof (ValueType).IsAbstract, "#3");
1749 Assert.IsTrue (typeof (Enum).IsAbstract, "#4");
1750 Assert.IsFalse (typeof (TimeSpan).IsAbstract, "#5");
1751 Assert.IsTrue (typeof (TextReader).IsAbstract, "#6");
1754 // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=286308
1755 Type [] typeArgs = typeof (List<>).GetGenericArguments ();
1756 Assert.IsFalse (typeArgs [0].IsAbstract, "#7");
1760 public void IsCOMObject ()
1762 Type type = typeof (string);
1763 Assert.IsFalse (type.IsCOMObject, "#1");
1765 TypeBuilder tb = module.DefineType (genTypeName ());
1766 type = tb.CreateType ();
1767 Assert.IsFalse (type.IsCOMObject, "#2");
1771 public void IsImport ()
1773 Type type = typeof (string);
1774 Assert.IsFalse (type.IsImport, "#1");
1776 TypeBuilder tb = module.DefineType (genTypeName ());
1777 type = tb.CreateType ();
1778 Assert.IsFalse (type.IsImport, "#2");
1780 tb = module.DefineType (genTypeName (), TypeAttributes.Import |
1781 TypeAttributes.Interface | TypeAttributes.Abstract);
1782 type = tb.CreateType ();
1783 Assert.IsTrue (type.IsImport, "#3");
1787 public void IsInterface ()
1789 Assert.IsFalse (typeof (string).IsInterface, "#1");
1790 Assert.IsTrue (typeof (ICloneable).IsInterface, "#2");
1794 public void IsPrimitive () {
1795 Assert.IsTrue (typeof (IntPtr).IsPrimitive, "#1");
1796 Assert.IsTrue (typeof (int).IsPrimitive, "#2");
1797 Assert.IsFalse (typeof (string).IsPrimitive, "#2");
1801 public void IsValueType ()
1803 Assert.IsTrue (typeof (int).IsValueType, "#1");
1804 Assert.IsFalse (typeof (Enum).IsValueType, "#2");
1805 Assert.IsFalse (typeof (ValueType).IsValueType, "#3");
1806 Assert.IsTrue (typeof (AttributeTargets).IsValueType, "#4");
1807 Assert.IsFalse (typeof (string).IsValueType, "#5");
1808 Assert.IsTrue (typeof (TimeSpan).IsValueType, "#6");
1812 public void IsVisible ()
1814 Assert.IsTrue (typeof (int).IsVisible, "#1");
1815 Assert.IsTrue (typeof (Nested).IsVisible, "#2");
1819 public void GetTypeNonVectorArray ()
1821 Type t = Type.GetType ("System.String[*]");
1822 Assert.AreEqual ("System.String[*]", t.ToString ());
1827 public void TypeFromCLSID ()
1829 Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-c000-000000000046");
1830 Guid CLSID_Bogus = new Guid("1ea9d7a9-f7ab-443b-b486-30d285b21f1b");
1832 Type t1 = Type.GetTypeFromCLSID (CLSID_ShellDesktop);
1834 Type t2 = Type.GetTypeFromCLSID (CLSID_Bogus);
1836 Assert.AreEqual (t1.FullName, "System.__ComObject");
1838 if (!isMono && (Environment.OSVersion.Platform == PlatformID.Win32Windows ||
1839 Environment.OSVersion.Platform == PlatformID.Win32NT))
1840 Activator.CreateInstance(t1);
1842 Assert.AreEqual (t2.FullName, "System.__ComObject");
1844 Assert.AreNotEqual (t1, t2);
1848 [Category("NotWorking")] // Mono throws TargetInvokationException
1849 [ExpectedException("System.Runtime.InteropServices.COMException")]
1850 public void TypeFromCLSIDBogus ()
1852 Guid CLSID_Bogus = new Guid("1ea9d7a9-f7ab-443b-b486-30d285b21f1b");
1853 Type t = Type.GetTypeFromCLSID (CLSID_Bogus);
1854 if (Environment.OSVersion.Platform == PlatformID.Win32Windows ||
1855 Environment.OSVersion.Platform == PlatformID.Win32NT)
1856 Activator.CreateInstance(t);
1858 throw new COMException ();
1862 public void ExerciseFilterName ()
1864 MemberInfo[] mi = typeof(Base).FindMembers(
1866 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1867 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1868 Type.FilterName, "*");
1869 Assert.AreEqual (4, mi.Length);
1870 mi = typeof(Base).FindMembers(
1872 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1873 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1874 Type.FilterName, "Test*");
1875 Assert.AreEqual (2, mi.Length);
1876 mi = typeof(Base).FindMembers(
1878 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1879 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1880 Type.FilterName, "TestVoid");
1881 Assert.AreEqual (1, mi.Length);
1882 mi = typeof(Base).FindMembers(
1884 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1885 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1886 Type.FilterName, "NonExistingMethod");
1887 Assert.AreEqual (0, mi.Length);
1891 public void ExerciseFilterNameIgnoreCase ()
1893 MemberInfo[] mi = typeof(Base).FindMembers(
1895 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1896 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1897 Type.FilterNameIgnoreCase, "*");
1898 Assert.AreEqual (4, mi.Length);
1899 mi = typeof(Base).FindMembers(
1901 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1902 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1903 Type.FilterNameIgnoreCase, "test*");
1904 Assert.AreEqual (2, mi.Length);
1905 mi = typeof(Base).FindMembers(
1907 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1908 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1909 Type.FilterNameIgnoreCase, "TESTVOID");
1910 Assert.AreEqual (1, mi.Length);
1911 mi = typeof(Base).FindMembers(
1913 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1914 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1915 Type.FilterNameIgnoreCase, "NonExistingMethod");
1916 Assert.AreEqual (0, mi.Length);
1920 [ExpectedException (typeof (InvalidFilterCriteriaException))]
1921 public void FilterAttribute_Invalid ()
1923 Type.FilterAttribute (MethodBase.GetCurrentMethod (), (byte) 1);
1927 public void GenericParameterMemberType ()
1929 var t = typeof (Foo<>).GetGenericArguments () [0];
1930 Assert.IsNotNull (t);
1932 Assert.AreEqual (MemberTypes.TypeInfo, t.MemberType);
1938 public int property {
1941 public ByRef0 (int i) {}
1942 public void f (int i) {}
1946 public void ByrefTypes ()
1948 Type t = Type.GetType ("MonoTests.System.TypeTest+ByRef0&");
1949 Assert.IsNotNull (t);
1950 Assert.IsTrue (t.IsByRef);
1951 Assert.AreEqual (0, t.GetMethods (BindingFlags.Public | BindingFlags.Instance).Length);
1952 Assert.AreEqual (0, t.GetConstructors (BindingFlags.Public | BindingFlags.Instance).Length);
1953 Assert.AreEqual (0, t.GetEvents (BindingFlags.Public | BindingFlags.Instance).Length);
1954 Assert.AreEqual (0, t.GetProperties (BindingFlags.Public | BindingFlags.Instance).Length);
1956 Assert.IsNull (t.GetMethod ("f"));
1957 Assert.IsNull (t.GetField ("field"));
1958 Assert.IsNull (t.GetProperty ("property"));
1962 public void TestAssemblyQualifiedName ()
1964 Type t = Type.GetType ("System.Byte[]&");
1965 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte[]&"));
1967 t = Type.GetType ("System.Byte*&");
1968 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte*&"));
1970 t = Type.GetType ("System.Byte&");
1971 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte&"));
1976 #pragma warning disable 169
1978 #pragma warning restore 169
1982 public void CreateValueTypeNoCtor ()
1984 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, null);
1988 [ExpectedException (typeof (MissingMethodException))]
1989 public void CreateValueTypeNoCtorArgs ()
1991 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, new object [] { 1 });
1995 [ExpectedException (typeof (MissingMethodException))]
1996 public void InvokeGetPropertyMissing ()
1998 typeof(B).InvokeMember ("", BindingFlags.GetProperty, null, null, new object [] { 1 });
2002 [ExpectedException (typeof (MissingMethodException))]
2003 public void InvokeSetPropertyMissing ()
2005 typeof(B).InvokeMember ("", BindingFlags.SetProperty, null, null, new object [] { 1 });
2008 internal static string bug336841 (string param1, params string [] param2)
2010 StringBuilder sb = new StringBuilder ();
2014 for (int i = 0; i < param2.Length; i++) {
2017 sb.Append (param2 [i]);
2019 return sb.ToString ();
2022 internal static string bug336841 (string param1)
2024 return "#B:" + param1;
2027 internal static string bug336841 (params string [] param1)
2029 StringBuilder sb = new StringBuilder ();
2031 for (int i = 0; i < param1.Length; i++) {
2034 sb.Append (param1 [i]);
2036 return sb.ToString ();
2040 public void InvokeMember_GetSetField ()
2042 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2043 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2044 BindingFlags.SetField, null, null, new object [] { 5 });
2046 Assert.AreEqual (5, X.Value, "#A1");
2047 Assert.AreEqual (5, typeof (X).InvokeMember ("Value",
2048 BindingFlags.Public | BindingFlags.Static |
2049 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
2050 null, null, new object [0]), "#A2");
2051 Assert.AreEqual (5, Y.Value, "#A3");
2052 Assert.AreEqual (5, typeof (Y).InvokeMember ("Value",
2053 BindingFlags.Public | BindingFlags.Static |
2054 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
2055 null, null, new object [0]), "#A4");
2058 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2059 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2060 BindingFlags.GetField | BindingFlags.SetField,
2061 null, null, new object [] { 5 });
2062 Assert.Fail ("#B1");
2063 } catch (ArgumentException ex) {
2064 // Cannot specify both Get and Set on a field
2065 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
2066 Assert.IsNull (ex.InnerException, "#B3");
2067 Assert.IsNotNull (ex.Message, "#B4");
2068 Assert.IsNotNull (ex.ParamName, "#B5");
2069 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
2074 public void InvokeMember_GetSetProperty ()
2077 typeof (ArrayList).InvokeMember ("Item",
2078 BindingFlags.GetProperty | BindingFlags.SetProperty |
2079 BindingFlags.Instance | BindingFlags.Public,
2080 null, new ArrayList (), new object [] { 0, "bar" });
2082 } catch (ArgumentException ex) {
2083 // Cannot specify both Get and Set on a property
2084 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2085 Assert.IsNull (ex.InnerException, "#3");
2086 Assert.IsNotNull (ex.Message, "#4");
2087 Assert.IsNotNull (ex.ParamName, "#5");
2088 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2094 public void InvokeMember_InvokeMethod_Set ()
2097 typeof (ArrayList).InvokeMember ("ToString",
2098 BindingFlags.InvokeMethod | BindingFlags.SetField |
2099 BindingFlags.Instance | BindingFlags.Public,
2100 null, new ArrayList (), new object [0]);
2101 Assert.Fail ("#A1");
2102 } catch (ArgumentException ex) {
2103 // Cannot specify Set on a field and Invoke on a method
2104 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
2105 Assert.IsNull (ex.InnerException, "#A3");
2106 Assert.IsNotNull (ex.Message, "#A4");
2107 Assert.IsNotNull (ex.ParamName, "#A5");
2108 Assert.AreEqual ("bindingFlags", ex.ParamName, "#A6");
2112 typeof (ArrayList).InvokeMember ("ToString",
2113 BindingFlags.InvokeMethod | BindingFlags.SetProperty |
2114 BindingFlags.Instance | BindingFlags.Public,
2115 null, new ArrayList (), new object [0]);
2116 Assert.Fail ("#B1");
2117 } catch (ArgumentException ex) {
2118 // Cannot specify Set on a property and Invoke on a method
2119 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
2120 Assert.IsNull (ex.InnerException, "#B3");
2121 Assert.IsNotNull (ex.Message, "#B4");
2122 Assert.IsNotNull (ex.ParamName, "#B5");
2123 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
2128 public void InvokeMember_MatchPrimitiveTypeWithInterface ()
2130 object [] invokeargs = { 1 };
2131 typeof (Z).InvokeMember ("", BindingFlags.DeclaredOnly |
2132 BindingFlags.Public | BindingFlags.NonPublic |
2133 BindingFlags.Instance | BindingFlags.CreateInstance,
2134 null, null, invokeargs);
2138 public void InvokeMember_Name_Null ()
2141 typeof (X).InvokeMember ((string) null,
2142 BindingFlags.Public | BindingFlags.Static |
2143 BindingFlags.FlattenHierarchy | BindingFlags.SetField,
2144 null, null, new object [] { 5 });
2146 } catch (ArgumentNullException ex) {
2147 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2148 Assert.IsNull (ex.InnerException, "#3");
2149 Assert.IsNotNull (ex.Message, "#4");
2150 Assert.IsNotNull (ex.ParamName, "#5");
2151 Assert.AreEqual ("name", ex.ParamName, "#6");
2156 public void InvokeMember_NoOperation ()
2159 typeof (TypeTest).InvokeMember ("Run", BindingFlags.Public |
2160 BindingFlags.Static, null, null, new object [0]);
2162 } catch (ArgumentException ex) {
2163 // Must specify binding flags describing the
2164 // invoke operation required
2165 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2166 Assert.IsNull (ex.InnerException, "#3");
2167 Assert.IsNotNull (ex.Message, "#4");
2168 Assert.IsNotNull (ex.ParamName, "#5");
2169 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2173 [Test] // bug #321735
2174 public void InvokeMember_SetFieldProperty ()
2176 ArrayList list = new ArrayList ();
2178 list.GetType ().InvokeMember ("Item",
2179 BindingFlags.SetField | BindingFlags.SetProperty |
2180 BindingFlags.Instance | BindingFlags.Public,
2181 null, list, new object [] { 0, "bar" });
2182 Assert.AreEqual ("bar", list [0]);
2186 public void InvokeMember_SetField_ProvidedArgs ()
2189 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2190 BindingFlags.Static | BindingFlags.SetField,
2191 null, null, new object [0]);
2192 Assert.Fail ("#A1");
2193 } catch (ArgumentException ex) {
2194 // Only the field value can be specified to set
2196 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
2197 Assert.IsNull (ex.InnerException, "#A3");
2198 Assert.IsNotNull (ex.Message, "#A4");
2199 Assert.IsNotNull (ex.ParamName, "#A5");
2200 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2204 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2205 BindingFlags.Static | BindingFlags.SetField,
2207 Assert.Fail ("#B1");
2208 } catch (ArgumentNullException ex) {
2209 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2210 Assert.IsNull (ex.InnerException, "#B3");
2211 Assert.IsNotNull (ex.Message, "#B4");
2212 Assert.IsNotNull (ex.ParamName, "#B5");
2213 Assert.AreEqual ("providedArgs", ex.ParamName, "#B6");
2217 [Test] // bug #336841
2218 [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306797
2219 public void InvokeMember_VarArgs ()
2221 BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.Public |
2222 BindingFlags.NonPublic | BindingFlags.OptionalParamBinding |
2223 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2224 BindingFlags.Instance;
2226 Type type = typeof (TypeTest);
2227 string result = (string) type.InvokeMember ("bug336841",
2228 flags, null, null, new object [] { "1" });
2229 Assert.IsNotNull (result, "#A1");
2230 Assert.AreEqual ("#B:1", result, "#A2");
2232 result = (string) type.InvokeMember ("bug336841", flags,
2233 null, null, new object [] { "1", "2", "3", "4" });
2234 Assert.IsNotNull (result, "#B1");
2235 Assert.AreEqual ("#A:1|2,3,4", result, "#B2");
2239 [Test] // bug #348522
2240 public void InvokeMember_WithoutDefaultValue ()
2242 BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;
2244 typeof (Bug348522).InvokeMember ("Test", flags, new FirstMethodBinder (), new Bug348522(),
2245 new object [] {Missing.Value}, null, null, null);
2247 } catch (ArgumentException ex) {
2248 // Missing parameter does not have a default value
2249 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2250 Assert.IsNull (ex.InnerException, "#3");
2251 Assert.IsNotNull (ex.Message, "#4");
2252 Assert.IsNotNull (ex.ParamName, "#5");
2253 Assert.AreEqual ("parameters", ex.ParamName, "#6");
2258 public void TestMissing () {
2259 Assert.AreEqual (Type.Missing, Missing.Value);
2263 public void GetGenericMethodDefinitionOverInflatedMethodOnGTD () {
2264 var s = new List<int> () { 1, 2, 3 }.ConvertAll ( i => i.ToString () );
2265 Assert.AreEqual (3, s.Count);
2266 var l = typeof (List<>);
2267 var m = l.GetMethod ("ConvertAll");
2268 var infl = m.MakeGenericMethod (typeof (int));
2269 var res = m.GetGenericMethodDefinition ();
2270 Assert.AreEqual (m, res, "#1");
2271 Assert.AreEqual (1, infl.GetGenericArguments().Length, "#2");
2275 public void InvokeMember_OutParam ()
2277 object[] args = new object[] { new string [0] };
2278 typeof (TypeTest).InvokeMember ("OutTest", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, args);
2279 Assert.IsTrue (args [0] is string[]);
2280 Assert.AreEqual (10, ((string[])args[0]).Length);
2283 public static void OutTest (out string[] a1)
2285 a1 = new string [10];
2290 public static int Value;
2299 public Z (IComparable value)
2304 public static void Run ()
2312 public TakesInt (int x)
2317 public int Integer {
2324 public TakesObject (object x) {}
2327 [Test] // bug #75241
2328 public void GetConstructorNullInTypes ()
2330 // This ends up calling type.GetConstructor ()
2331 Activator.CreateInstance (typeof (TakesInt), new object [] { null });
2332 Activator.CreateInstance (typeof (TakesObject), new object [] { null });
2336 public void GetConstructor_TakeInt_Object ()
2338 Assert.IsNull (typeof (TakesInt).GetConstructor (new Type[1] { typeof (object) }));
2342 public void GetCustomAttributes_All ()
2344 object [] attrs = typeof (A).GetCustomAttributes (false);
2345 Assert.AreEqual (2, attrs.Length, "#A1");
2346 Assert.IsTrue (HasAttribute (attrs, typeof (FooAttribute)), "#A2");
2347 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#A3");
2349 attrs = typeof (BA).GetCustomAttributes (false);
2350 Assert.AreEqual (1, attrs.Length, "#B1");
2351 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#B2");
2353 attrs = typeof (BA).GetCustomAttributes (true);
2354 Assert.AreEqual (2, attrs.Length, "#C1");
2355 Assert.IsTrue (HasAttribute (attrs, typeof (BarAttribute)), "#C2");
2356 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#C3");
2358 attrs = typeof (CA).GetCustomAttributes (false);
2359 Assert.AreEqual (0, attrs.Length, "#D");
2361 attrs = typeof (CA).GetCustomAttributes (true);
2362 Assert.AreEqual (1, attrs.Length, "#E1");
2363 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E2");
2366 static bool HasAttribute (object [] attrs, Type attributeType)
2368 foreach (object attr in attrs)
2369 if (attr.GetType () == attributeType)
2375 public void GetCustomAttributes_Type ()
2377 object [] attrs = null;
2379 attrs = typeof (A).GetCustomAttributes (
2380 typeof (VolatileModifier), false);
2381 Assert.AreEqual (1, attrs.Length, "#A1");
2382 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A2");
2383 attrs = typeof (A).GetCustomAttributes (
2384 typeof (VolatileModifier), true);
2385 Assert.AreEqual (1, attrs.Length, "#A3");
2386 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A4");
2388 attrs = typeof (A).GetCustomAttributes (
2389 typeof (NemerleAttribute), false);
2390 Assert.AreEqual (1, attrs.Length, "#B1");
2391 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B2");
2392 attrs = typeof (A).GetCustomAttributes (
2393 typeof (NemerleAttribute), true);
2394 Assert.AreEqual (1, attrs.Length, "#B3");
2395 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B4");
2397 attrs = typeof (A).GetCustomAttributes (
2398 typeof (FooAttribute), false);
2399 Assert.AreEqual (1, attrs.Length, "#C1");
2400 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C2");
2401 attrs = typeof (A).GetCustomAttributes (
2402 typeof (FooAttribute), false);
2403 Assert.AreEqual (1, attrs.Length, "#C3");
2404 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C4");
2406 attrs = typeof (BA).GetCustomAttributes (
2407 typeof (VolatileModifier), false);
2408 Assert.AreEqual (0, attrs.Length, "#D1");
2409 attrs = typeof (BA).GetCustomAttributes (
2410 typeof (VolatileModifier), true);
2411 Assert.AreEqual (1, attrs.Length, "#D2");
2412 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#D3");
2414 attrs = typeof (BA).GetCustomAttributes (
2415 typeof (NemerleAttribute), false);
2416 Assert.AreEqual (0, attrs.Length, "#E1");
2417 attrs = typeof (BA).GetCustomAttributes (
2418 typeof (NemerleAttribute), true);
2419 Assert.AreEqual (1, attrs.Length, "#E2");
2420 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E3");
2422 attrs = typeof (BA).GetCustomAttributes (
2423 typeof (FooAttribute), false);
2424 Assert.AreEqual (1, attrs.Length, "#F1");
2425 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F2");
2426 attrs = typeof (BA).GetCustomAttributes (
2427 typeof (FooAttribute), true);
2428 Assert.AreEqual (1, attrs.Length, "#F3");
2429 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F4");
2431 attrs = typeof (bug82431A1).GetCustomAttributes (
2432 typeof (InheritAttribute), false);
2433 Assert.AreEqual (1, attrs.Length, "#G1");
2434 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G2");
2435 attrs = typeof (bug82431A1).GetCustomAttributes (
2436 typeof (InheritAttribute), true);
2437 Assert.AreEqual (1, attrs.Length, "#G3");
2438 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G4");
2440 attrs = typeof (bug82431A1).GetCustomAttributes (
2441 typeof (NotInheritAttribute), false);
2442 Assert.AreEqual (1, attrs.Length, "#H1");
2443 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H2");
2444 attrs = typeof (bug82431A1).GetCustomAttributes (
2445 typeof (InheritAttribute), true);
2446 Assert.AreEqual (1, attrs.Length, "#H3");
2447 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H4");
2449 attrs = typeof (bug82431A2).GetCustomAttributes (
2450 typeof (InheritAttribute), false);
2451 Assert.AreEqual (0, attrs.Length, "#I1");
2452 attrs = typeof (bug82431A2).GetCustomAttributes (
2453 typeof (InheritAttribute), true);
2454 Assert.AreEqual (0, attrs.Length, "#I2");
2456 attrs = typeof (bug82431A2).GetCustomAttributes (
2457 typeof (NotInheritAttribute), false);
2458 Assert.AreEqual (0, attrs.Length, "#J1");
2459 attrs = typeof (bug82431A2).GetCustomAttributes (
2460 typeof (NotInheritAttribute), true);
2461 Assert.AreEqual (0, attrs.Length, "#J2");
2463 attrs = typeof (bug82431A3).GetCustomAttributes (
2464 typeof (InheritAttribute), false);
2465 Assert.AreEqual (2, attrs.Length, "#K1");
2466 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K2");
2467 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K3");
2468 attrs = typeof (bug82431A3).GetCustomAttributes (
2469 typeof (InheritAttribute), true);
2470 Assert.AreEqual (2, attrs.Length, "#K4");
2471 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K5");
2472 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K6");
2474 attrs = typeof (bug82431A3).GetCustomAttributes (
2475 typeof (NotInheritAttribute), false);
2476 Assert.AreEqual (1, attrs.Length, "#L1");
2477 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L2");
2478 attrs = typeof (bug82431A3).GetCustomAttributes (
2479 typeof (NotInheritAttribute), true);
2480 Assert.AreEqual (1, attrs.Length, "#L3");
2481 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L4");
2483 attrs = typeof (bug82431B1).GetCustomAttributes (
2484 typeof (InheritAttribute), false);
2485 Assert.AreEqual (1, attrs.Length, "#M1");
2486 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M2");
2487 attrs = typeof (bug82431B1).GetCustomAttributes (
2488 typeof (InheritAttribute), true);
2489 Assert.AreEqual (1, attrs.Length, "#M3");
2490 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M4");
2492 attrs = typeof (bug82431B1).GetCustomAttributes (
2493 typeof (NotInheritAttribute), false);
2494 Assert.AreEqual (0, attrs.Length, "#N1");
2495 attrs = typeof (bug82431B1).GetCustomAttributes (
2496 typeof (NotInheritAttribute), true);
2497 Assert.AreEqual (0, attrs.Length, "#N2");
2499 attrs = typeof (bug82431B2).GetCustomAttributes (
2500 typeof (InheritAttribute), false);
2501 Assert.AreEqual (0, attrs.Length, "#O1");
2502 attrs = typeof (bug82431B2).GetCustomAttributes (
2503 typeof (InheritAttribute), true);
2504 Assert.AreEqual (1, attrs.Length, "#O2");
2505 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#O3");
2507 attrs = typeof (bug82431B2).GetCustomAttributes (
2508 typeof (NotInheritAttribute), false);
2509 Assert.AreEqual (0, attrs.Length, "#P1");
2510 attrs = typeof (bug82431B2).GetCustomAttributes (
2511 typeof (NotInheritAttribute), true);
2512 Assert.AreEqual (0, attrs.Length, "#P2");
2514 attrs = typeof (bug82431B3).GetCustomAttributes (
2515 typeof (InheritAttribute), false);
2516 Assert.AreEqual (1, attrs.Length, "#Q1");
2517 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q2");
2518 attrs = typeof (bug82431B3).GetCustomAttributes (
2519 typeof (InheritAttribute), true);
2520 Assert.AreEqual (2, attrs.Length, "#Q3");
2521 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q4");
2522 Assert.AreEqual (typeof (InheritAttribute), attrs [1].GetType (), "#Q5");
2524 attrs = typeof (bug82431B3).GetCustomAttributes (
2525 typeof (NotInheritAttribute), false);
2526 Assert.AreEqual (1, attrs.Length, "#R1");
2527 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R2");
2528 attrs = typeof (bug82431B3).GetCustomAttributes (
2529 typeof (NotInheritAttribute), true);
2530 Assert.AreEqual (1, attrs.Length, "#R3");
2531 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R4");
2533 attrs = typeof (bug82431B4).GetCustomAttributes (
2534 typeof (InheritAttribute), false);
2535 Assert.AreEqual (0, attrs.Length, "#S1");
2536 attrs = typeof (bug82431B4).GetCustomAttributes (
2537 typeof (InheritAttribute), true);
2538 Assert.AreEqual (1, attrs.Length, "#S2");
2539 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#S3");
2541 attrs = typeof (bug82431B4).GetCustomAttributes (
2542 typeof (NotInheritAttribute), false);
2543 Assert.AreEqual (0, attrs.Length, "#T1");
2544 attrs = typeof (bug82431B4).GetCustomAttributes (
2545 typeof (NotInheritAttribute), true);
2546 Assert.AreEqual (0, attrs.Length, "#T2");
2548 attrs = typeof (A).GetCustomAttributes (
2549 typeof (string), false);
2550 Assert.AreEqual (0, attrs.Length, "#U1");
2551 attrs = typeof (A).GetCustomAttributes (
2552 typeof (string), true);
2553 Assert.AreEqual (0, attrs.Length, "#U2");
2556 [Test] // bug #76150
2557 public void IsDefined ()
2559 Assert.IsTrue (typeof (A).IsDefined (typeof (NemerleAttribute), false), "#A1");
2560 Assert.IsTrue (typeof (A).IsDefined (typeof (VolatileModifier), false), "#A2");
2561 Assert.IsTrue (typeof (A).IsDefined (typeof (FooAttribute), false), "#A3");
2562 Assert.IsFalse (typeof (A).IsDefined (typeof (BarAttribute), false), "#A4");
2564 Assert.IsFalse (typeof (BA).IsDefined (typeof (NemerleAttribute), false), "#B1");
2565 Assert.IsFalse (typeof (BA).IsDefined (typeof (VolatileModifier), false), "#B2");
2566 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), false), "#B3");
2567 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), false), "#B4");
2568 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), false), "#B5");
2569 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), false), "#B6");
2570 Assert.IsTrue (typeof (BA).IsDefined (typeof (NemerleAttribute), true), "#B7");
2571 Assert.IsTrue (typeof (BA).IsDefined (typeof (VolatileModifier), true), "#B8");
2572 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), true), "#B9");
2573 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), true), "#B10");
2574 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), true), "#B11");
2575 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), true), "#B12");
2579 public void IsDefined_AttributeType_Null ()
2582 typeof (BA).IsDefined ((Type) null, false);
2584 } catch (ArgumentNullException ex) {
2585 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2586 Assert.IsNull (ex.InnerException, "#3");
2587 Assert.IsNotNull (ex.Message, "#4");
2588 Assert.IsNotNull (ex.ParamName, "#5");
2589 Assert.AreEqual ("attributeType", ex.ParamName, "#6");
2593 [Test] // bug #82431
2594 [Category ("NotWorking")]
2595 public void IsDefined_Inherited ()
2597 Assert.IsFalse (typeof (CA).IsDefined (typeof (NemerleAttribute), false), "#C1");
2598 Assert.IsFalse (typeof (CA).IsDefined (typeof (VolatileModifier), false), "#C2");
2599 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), false), "#C3");
2600 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), false), "#C4");
2601 Assert.IsTrue (typeof (CA).IsDefined (typeof (NemerleAttribute), true), "#C5");
2602 Assert.IsTrue (typeof (CA).IsDefined (typeof (VolatileModifier), true), "#C6");
2603 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), true), "#C7");
2604 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), true), "#C8");
2606 Assert.IsFalse (typeof (BBA).IsDefined (typeof (NemerleAttribute), false), "#D1");
2607 Assert.IsFalse (typeof (BBA).IsDefined (typeof (VolatileModifier), false), "#D2");
2608 Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), false), "#D3");
2609 Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), false), "#D4");
2610 Assert.IsTrue (typeof (BBA).IsDefined (typeof (NemerleAttribute), true), "#D5");
2611 Assert.IsTrue (typeof (BBA).IsDefined (typeof (VolatileModifier), true), "#D6");
2612 Assert.IsTrue (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2613 Assert.IsTrue (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2615 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), false), "#E1");
2616 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), false), "#E2");
2617 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), true), "#E3");
2618 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), true), "#E4");
2620 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), false), "#F1");
2621 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), false), "#F2");
2622 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2623 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), true), "#F4");
2625 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), false), "#G1");
2626 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), false), "#G2");
2627 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), true), "#G3");
2628 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), true), "#G4");
2630 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), false), "#H1");
2631 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), false), "#H2");
2632 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), true), "#H3");
2633 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), true), "#H4");
2635 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), false), "#I1");
2636 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), false), "#I2");
2637 Assert.IsTrue (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), true), "#I3");
2638 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), true), "#I4");
2640 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), false), "#J1");
2641 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), false), "#J2");
2642 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), true), "#J3");
2643 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), true), "#J4");
2645 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), false), "#K2");
2646 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), false), "#K2");
2647 Assert.IsTrue (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), true), "#K3");
2648 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
2651 class Bug13767Attribute : Attribute
2653 public object[] field;
2655 public Bug13767Attribute (params object[] args)
2661 public enum Bug13767Enum
2667 [Bug13767("Demo", new[] { Bug13767Enum.Value1, Bug13767Enum.Value0 })]
2668 public void Bug13767Method(string attributeName, Bug13767Enum[]options)
2674 public void CustomAttributeWithNestedArrayOfEnum ()
2676 var m = GetType ().GetMethod ("Bug13767Method");
2678 var attr = m.GetCustomAttributes (false);
2679 Assert.AreEqual (1, attr.Length, "#1");
2681 var tc = (Bug13767Attribute)attr[0];
2682 Assert.AreEqual (2, tc.field.Length, "#2");
2683 Assert.AreEqual ("Demo", tc.field[0], "#3");
2684 Assert.IsNotNull (tc.field[1], "#4");
2686 var arr = (Bug13767Enum[])tc.field [1];
2687 Assert.AreEqual (2, arr.Length, "#5");
2688 Assert.AreEqual (Bug13767Enum.Value1, arr [0], "#6");
2689 Assert.AreEqual (Bug13767Enum.Value0, arr [1], "#7");
2692 [Test] // GetType (String)
2693 public void GetType1_TypeName_Null ()
2696 Type.GetType ((string) 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.AreEqual ("TypeName", ex.ParamName, "#5");
2706 [Test] // GetType (String, Boolean)
2707 public void GetType2_TypeName_Null ()
2710 Type.GetType ((string) null, false);
2712 } catch (ArgumentNullException ex) {
2713 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2714 Assert.IsNull (ex.InnerException, "#3");
2715 Assert.IsNotNull (ex.Message, "#4");
2716 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2720 [Test] // GetType (String, Boolean, Boolean)
2721 public void GetType3_TypeName_Null ()
2724 Type.GetType ((string) null, false, false);
2726 } catch (ArgumentNullException ex) {
2727 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2728 Assert.IsNull (ex.InnerException, "#3");
2729 Assert.IsNotNull (ex.Message, "#4");
2730 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2735 public void GetTypeArray_Args_Null ()
2738 Type.GetTypeArray ((object []) null);
2740 } catch (ArgumentNullException ex) {
2741 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2742 Assert.IsNull (ex.InnerException, "#3");
2743 Assert.IsNotNull (ex.Message, "#4");
2744 Assert.AreEqual ("args", ex.ParamName, "#5");
2749 public void GetTypeCode ()
2751 Assert.AreEqual (TypeCode.Boolean, Type.GetTypeCode (typeof (bool)), "#1");
2752 Assert.AreEqual (TypeCode.Byte, Type.GetTypeCode (typeof (byte)), "#2");
2753 Assert.AreEqual (TypeCode.Char, Type.GetTypeCode (typeof (char)), "#3");
2754 Assert.AreEqual (TypeCode.DateTime, Type.GetTypeCode (typeof (DateTime)), "#4");
2755 Assert.AreEqual (TypeCode.DBNull, Type.GetTypeCode (typeof (DBNull)), "#5");
2756 Assert.AreEqual (TypeCode.Decimal, Type.GetTypeCode (typeof (decimal)), "#6");
2757 Assert.AreEqual (TypeCode.Double, Type.GetTypeCode (typeof (double)), "#7");
2758 Assert.AreEqual (TypeCode.Empty, Type.GetTypeCode (null), "#8");
2759 Assert.AreEqual (TypeCode.Int16, Type.GetTypeCode (typeof (short)), "#9");
2760 Assert.AreEqual (TypeCode.Int32, Type.GetTypeCode (typeof (int)), "#10");
2761 Assert.AreEqual (TypeCode.Int64, Type.GetTypeCode (typeof (long)), "#11");
2762 Assert.AreEqual (TypeCode.Object, Type.GetTypeCode (typeof (TakesInt)), "#12");
2763 Assert.AreEqual (TypeCode.SByte, Type.GetTypeCode (typeof (sbyte)), "#13");
2764 Assert.AreEqual (TypeCode.Single, Type.GetTypeCode (typeof (float)), "#14");
2765 Assert.AreEqual (TypeCode.String, Type.GetTypeCode (typeof (string)), "#15");
2766 Assert.AreEqual (TypeCode.UInt16, Type.GetTypeCode (typeof (ushort)), "#16");
2767 Assert.AreEqual (TypeCode.UInt32, Type.GetTypeCode (typeof (uint)), "#17");
2768 Assert.AreEqual (TypeCode.UInt64, Type.GetTypeCode (typeof (ulong)), "#18");
2772 public void GetTypeFromHandle_Handle_Zero ()
2774 RuntimeTypeHandle handle = new RuntimeTypeHandle ();
2776 Assert.IsNull (Type.GetTypeFromHandle (handle));
2780 public void GetTypeHandle_O_Null ()
2783 Type.GetTypeHandle (null);
2785 } catch (ArgumentNullException ex) {
2786 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2787 Assert.IsNull (ex.InnerException, "#3");
2788 Assert.IsNotNull (ex.Message, "#4");
2789 Assert.IsNull (ex.ParamName, "#5");
2793 [Test] // GetConstructor (Type [])
2794 public void GetConstructor1 ()
2797 ConstructorInfo ctor;
2799 type = typeof (CtorsA);
2800 ctor = type.GetConstructor (Type.EmptyTypes);
2801 Assert.IsNotNull (ctor, "#A1");
2802 Assert.AreEqual (0, ctor.GetParameters ().Length, "#A2");
2803 Assert.IsFalse (ctor.IsStatic, "#A3");
2804 Assert.IsTrue (ctor.IsPublic, "#A4");
2805 Assert.AreEqual (".ctor", ctor.Name, "#A5");
2807 type = typeof (CtorsB);
2808 ctor = type.GetConstructor (Type.EmptyTypes);
2809 Assert.IsNotNull (ctor, "#B1");
2810 Assert.AreEqual (0, ctor.GetParameters ().Length, "#B2");
2811 Assert.IsFalse (ctor.IsStatic, "#B3");
2812 Assert.IsTrue (ctor.IsPublic, "#B4");
2813 Assert.AreEqual (".ctor", ctor.Name, "#B5");
2815 type = typeof (CtorsC);
2816 ctor = type.GetConstructor (Type.EmptyTypes);
2817 Assert.IsNull (ctor, "#C");
2819 type = typeof (CtorsC);
2820 ctor = type.GetConstructor (new Type [] { typeof (int) });
2821 Assert.IsNotNull (ctor, "#D1");
2822 Assert.AreEqual (1, ctor.GetParameters ().Length, "#D2");
2823 Assert.IsFalse (ctor.IsStatic, "#D3");
2824 Assert.IsTrue (ctor.IsPublic, "#D4");
2825 Assert.AreEqual (".ctor", ctor.Name, "#D5");
2828 [Test] // GetConstructor (Type [])
2829 public void GetConstructor1_Types_Null ()
2832 typeof (BindingFlags).GetConstructor (null);
2834 } catch (ArgumentNullException ex) {
2835 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2836 Assert.IsNull (ex.InnerException, "#3");
2837 Assert.IsNotNull (ex.Message, "#4");
2838 Assert.IsNotNull (ex.ParamName, "#5");
2839 Assert.AreEqual ("types", ex.ParamName, "#6");
2843 [Test] // GetConstructor (Type [])
2844 public void GetConstructor1_Types_ItemNull ()
2846 Type type = typeof (BindingFlags);
2848 type.GetConstructor (new Type[1] { null });
2849 Assert.Fail ("#A1");
2850 } catch (ArgumentNullException ex) {
2851 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
2852 Assert.IsNull (ex.InnerException, "#A3");
2853 Assert.IsNotNull (ex.Message, "#A4");
2854 Assert.IsNotNull (ex.ParamName, "#A5");
2855 Assert.AreEqual ("types", ex.ParamName, "#A6");
2858 type = typeof (TakesInt);
2860 type.GetConstructor (new Type [1] { null });
2861 Assert.Fail ("#B1");
2862 } catch (ArgumentNullException ex) {
2863 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2864 Assert.IsNull (ex.InnerException, "#B3");
2865 Assert.IsNotNull (ex.Message, "#B4");
2866 Assert.IsNotNull (ex.ParamName, "#B5");
2867 Assert.AreEqual ("types", ex.ParamName, "#B6");
2871 [Test] // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier [])
2872 public void GetConstructor2_Types_ItemNull ()
2874 Type type = typeof (BindingFlags);
2876 type.GetConstructor (BindingFlags.Default, null,
2877 new Type[1] { null }, null);
2879 } catch (ArgumentNullException ex) {
2880 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2881 Assert.IsNull (ex.InnerException, "#3");
2882 Assert.IsNotNull (ex.Message, "#4");
2883 Assert.IsNotNull (ex.ParamName, "#5");
2884 Assert.AreEqual ("types", ex.ParamName, "#6");
2888 [Test] // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier [])
2889 public void GetConstructor3_Types_ItemNull ()
2891 Type type = typeof (BindingFlags);
2893 type.GetConstructor (BindingFlags.Default,
2894 null, CallingConventions.Any,
2895 new Type[1] { null }, null);
2897 } catch (ArgumentNullException ex) {
2898 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2899 Assert.IsNull (ex.InnerException, "#3");
2900 Assert.IsNotNull (ex.Message, "#4");
2901 Assert.IsNotNull (ex.ParamName, "#5");
2902 Assert.AreEqual ("types", ex.ParamName, "#6");
2907 public void GetMethod_Bug77367 ()
2909 MethodInfo i = typeof (Bug77367).GetMethod ("Run", Type.EmptyTypes);
2915 public void EqualsUnderlyingType ()
2917 AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
2918 TypeAttributes attribs = TypeAttributes.Public;
2920 AssemblyName name = new AssemblyName ();
2921 name.Name = "enumtest";
2922 AssemblyBuilder assembly =
2923 AppDomain.CurrentDomain.DefineDynamicAssembly (
2926 ModuleBuilder module = assembly.DefineDynamicModule
2927 ("m", "enumtest.dll");
2928 EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
2930 Assert.IsTrue (typeof (int).Equals (e));
2935 public void Equals_Type_Null ()
2937 Assert.IsFalse (typeof (int).Equals ((Type) null), "#1");
2938 Assert.IsFalse (typeof (int).Equals ((object) null), "#2");
2942 public void GetElementType_Bug63841 ()
2944 Assert.IsNull (typeof (TheEnum).GetElementType (), "#1");
2948 public void FullNameGenerics ()
2950 Type fooType = typeof (Foo<>);
2951 FieldInfo [] fields = fooType.GetFields ();
2953 Assert.AreEqual (1, fields.Length, "#0");
2955 Assert.IsNotNull (fooType.FullName, "#1");
2956 Assert.IsNotNull (fooType.AssemblyQualifiedName, "#1a");
2958 FieldInfo field = fooType.GetField ("Whatever");
2959 Assert.IsNotNull (field, "#2");
2960 Assert.AreEqual (field, fields [0], "#2a");
2961 Assert.IsNull (field.FieldType.FullName, "#3");
2962 Assert.IsNull (field.FieldType.AssemblyQualifiedName, "#3a");
2963 Assert.IsNotNull (field.FieldType.ToString (), "#4");
2965 PropertyInfo prop = fooType.GetProperty ("Test");
2966 Assert.IsNotNull (prop, "#5");
2967 Assert.IsNull (prop.PropertyType.FullName, "#6");
2968 Assert.IsNull (prop.PropertyType.AssemblyQualifiedName, "#6a");
2969 Assert.IsNotNull (prop.PropertyType.ToString (), "#7");
2971 MethodInfo method = fooType.GetMethod("Execute");
2972 Assert.IsNotNull (method, "#8");
2973 Assert.IsNull (method.ReturnType.FullName, "#9");
2974 Assert.IsNull (method.ReturnType.AssemblyQualifiedName, "#9a");
2975 Assert.IsNotNull (method.ReturnType.ToString (), "#10");
2977 ParameterInfo[] parameters = method.GetParameters();
2978 Assert.AreEqual (1, parameters.Length, "#11");
2979 Assert.IsNull (parameters[0].ParameterType.FullName, "#12");
2980 Assert.IsNull (parameters[0].ParameterType.AssemblyQualifiedName, "#12a");
2981 Assert.IsNotNull (parameters[0].ParameterType.ToString (), "#13");
2985 public void TypeParameterIsNotGeneric ()
2987 Type fooType = typeof (Foo<>);
2988 Type type_param = fooType.GetGenericArguments () [0];
2989 Assert.IsTrue (type_param.IsGenericParameter);
2990 Assert.IsFalse (type_param.IsGenericType);
2991 Assert.IsFalse (type_param.IsGenericTypeDefinition);
2993 // LAMESPEC: MSDN claims that this should be false, but .NET v2.0.50727 says it's true
2994 // http://msdn2.microsoft.com/en-us/library/system.type.isgenerictype.aspx
2995 Assert.IsTrue (type_param.ContainsGenericParameters);
2999 public void IsAssignable ()
3001 Type foo_type = typeof (Foo<>);
3002 Type foo_int_type = typeof (Foo<int>);
3003 Assert.IsFalse (foo_type.IsAssignableFrom (foo_int_type), "Foo<int> -!-> Foo<>");
3004 Assert.IsFalse (foo_int_type.IsAssignableFrom (foo_type), "Foo<> -!-> Foo<int>");
3006 Type ibar_short_type = typeof (IBar<short>);
3007 Type ibar_int_type = typeof (IBar<int>);
3008 Type baz_short_type = typeof (Baz<short>);
3009 Type baz_int_type = typeof (Baz<int>);
3011 Assert.IsTrue (ibar_int_type.IsAssignableFrom (baz_int_type), "Baz<int> -> IBar<int>");
3012 Assert.IsTrue (ibar_short_type.IsAssignableFrom (baz_short_type), "Baz<short> -> IBar<short>");
3014 Assert.IsFalse (ibar_int_type.IsAssignableFrom (baz_short_type), "Baz<short> -!-> IBar<int>");
3015 Assert.IsFalse (ibar_short_type.IsAssignableFrom (baz_int_type), "Baz<int> -!-> IBar<short>");
3018 Assert.IsTrue (typeof (Nullable<int>).IsAssignableFrom (typeof (int)));
3019 Assert.IsFalse (typeof (int).IsAssignableFrom (typeof (Nullable<int>)));
3020 Assert.IsTrue (typeof (Nullable<FooStruct>).IsAssignableFrom (typeof (FooStruct)));
3024 public void IsInstanceOf ()
3026 Assert.IsTrue (typeof (Nullable<int>).IsInstanceOfType (5));
3030 public void IsInstanceOfArrayOfNullable ()
3032 Assert.IsTrue (typeof (Nullable<int>[]).IsInstanceOfType (new Nullable<int> [0]));
3036 public void IsInstanceOfType_Null ()
3038 Assert.IsFalse (typeof (int).IsInstanceOfType (null), "int");
3039 Assert.IsFalse (typeof (object).IsInstanceOfType (null), "object");
3040 Assert.IsFalse (typeof (int?).IsInstanceOfType (null), "int?");
3044 public void ByrefType ()
3046 Type foo_type = typeof (Foo<>);
3047 Type type_param = foo_type.GetGenericArguments () [0];
3048 Type byref_type_param = type_param.MakeByRefType ();
3049 Assert.IsFalse (byref_type_param.IsGenericParameter);
3050 Assert.IsNull (byref_type_param.DeclaringType);
3054 [ExpectedException (typeof (TypeLoadException))]
3055 public void MakeByRefByRef ()
3057 typeof (int).MakeByRefType ().MakeByRefType ();
3061 public void MakeArrayTypeTest ()
3063 // This should not crash:
3064 Type t = typeof (void).MakeArrayType ();
3068 [ExpectedException (typeof (InvalidProgramException))]
3069 public void MakeArrayTypedReferenceInstanceTest ()
3071 object o = Array.CreateInstance (typeof (global::System.TypedReference), 1);
3075 public void MakeArrayTypeLargeRank ()
3077 Assert.Throws<TypeLoadException> (delegate () {
3078 typeof (int).MakeArrayType (33);
3083 public class ComFoo<T> {
3087 public void GetCustomAttributesGenericInstance ()
3089 Assert.AreEqual (1, typeof (ComFoo<int>).GetCustomAttributes (typeof (ComVisibleAttribute), true).Length);
3092 interface ByRef1<T> { void f (ref T t); }
3093 interface ByRef2 { void f<T> (ref T t); }
3095 interface ByRef3<T> where T:struct { void f (ref T? t); }
3096 interface ByRef4 { void f<T> (ref T? t) where T:struct; }
3098 void CheckGenericByRef (Type t)
3100 string name = t.Name;
3101 t = t.GetMethod ("f").GetParameters () [0].ParameterType;
3103 Assert.IsFalse (t.IsGenericType, name);
3104 Assert.IsFalse (t.IsGenericTypeDefinition, name);
3105 Assert.IsFalse (t.IsGenericParameter, name);
3109 public void GenericByRef ()
3111 CheckGenericByRef (typeof (ByRef1<>));
3112 CheckGenericByRef (typeof (ByRef2));
3113 CheckGenericByRef (typeof (ByRef3<>));
3114 CheckGenericByRef (typeof (ByRef4));
3117 public class Bug80242<T> {
3118 public interface IFoo { }
3119 public class Bar : IFoo { }
3120 public class Baz : Bar { }
3124 public void TestNestedTypes ()
3126 Type t = typeof (Bug80242<object>);
3127 Assert.IsFalse (t.IsGenericTypeDefinition);
3128 foreach (Type u in t.GetNestedTypes ()) {
3129 Assert.IsTrue (u.IsGenericTypeDefinition, "{0} isn't a generic definition", u);
3130 Assert.AreEqual (u, u.GetGenericArguments () [0].DeclaringType);
3134 [Test] // bug #82211
3135 public void GetMembers_GenericArgument ()
3137 Type argType = typeof (ComFoo<>).GetGenericArguments () [0];
3138 MemberInfo [] members = argType.GetMembers ();
3139 Assert.IsNotNull (members, "#1");
3140 Assert.AreEqual (4, members.Length, "#2");
3144 [ExpectedException (typeof (ArgumentNullException))]
3145 public void ReflectionOnlyGetTypeNullTypeName ()
3147 Type.ReflectionOnlyGetType (null, false, false);
3151 public void ReflectionOnlyGetTypeDoNotThrow ()
3153 Assert.IsNull (Type.ReflectionOnlyGetType ("a, nonexistent.dll", false, false));
3157 [ExpectedException (typeof (FileNotFoundException))]
3158 public void ReflectionOnlyGetTypeThrow ()
3160 Type.ReflectionOnlyGetType ("a, nonexistent.dll", true, false);
3164 public void ReflectionOnlyGetType ()
3166 Type t = Type.ReflectionOnlyGetType (typeof (int).AssemblyQualifiedName.ToString (), true, true);
3167 Assert.AreEqual ("System.Int32", t.FullName);
3171 #if MONOTOUCH || FULL_AOT_RUNTIME
3172 [ExpectedException (typeof (NotSupportedException))]
3174 public void MakeGenericType_UserDefinedType ()
3176 Type ut = new UserType (typeof (int));
3177 Type t = typeof (Foo<>).MakeGenericType (ut);
3178 Assert.IsTrue (t.IsGenericType, "#A1");
3179 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
3181 Type arg = t.GetGenericArguments () [0];
3182 Assert.IsNotNull (arg, "#B1");
3183 Assert.IsFalse (arg.IsGenericType, "#B2");
3184 Assert.AreEqual (ut, arg, "#B3");
3188 #if MONOTOUCH || FULL_AOT_RUNTIME
3189 [ExpectedException (typeof (NotSupportedException))]
3191 public void MakeGenericType_NestedUserDefinedType ()
3193 Type ut = new UserType (new UserType (typeof (int)));
3194 Type t = typeof (Foo<>).MakeGenericType (ut);
3195 Assert.IsTrue (t.IsGenericType, "#A1");
3196 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
3198 Type arg = t.GetGenericArguments () [0];
3199 Assert.IsNotNull (arg, "#B1");
3200 Assert.IsFalse (arg.IsGenericType, "#B2");
3201 Assert.AreEqual (ut, arg, "#B3");
3205 #if MONOTOUCH || FULL_AOT_RUNTIME
3206 [ExpectedException (typeof (NotSupportedException))]
3208 public void TestMakeGenericType_UserDefinedType_DotNet20SP1 ()
3210 Type ut = new UserType(typeof(int));
3211 Type t = typeof(Foo<>).MakeGenericType(ut);
3212 Assert.IsTrue (t.IsGenericType, "#1");
3214 Assert.AreEqual (ut, t.GetGenericArguments()[0], "#2");
3218 #if MONOTOUCH || FULL_AOT_RUNTIME
3219 [ExpectedException (typeof (NotSupportedException))]
3221 public void MakeGenericType_BadUserType ()
3223 Type ut = new UserType (null);
3224 Type t = typeof (Foo<>).MakeGenericType (ut);
3225 var g0 = t.GetGenericArguments () [0];
3226 Assert.AreSame (g0, ut, "#1");
3230 public void MakeGenericType_WrongNumOfArguments ()
3233 Type t = typeof (Foo<,>).MakeGenericType (new Type [] { typeof (int) });
3235 } catch (ArgumentException) {
3239 [AttributeUsage (AttributeTargets.All)]
3240 public class DocAttribute : Attribute {
3241 public DocAttribute (string docs) {}
3244 class GenericClassWithAttributes<[Doc ("T")] T, [Doc ("B")] B>
3245 where T : class, new ()
3248 public T Bar { get{return null;}}
3250 public void M<[Doc ("X")] X> (X x)
3255 [Test] //bug #377596
3256 public void GetGenericArguments_ArgumentsHaveAttributes ()
3258 Type type = typeof(GenericClassWithAttributes<,>);
3259 Type[] tArgs = type.GetGenericArguments ();
3260 MethodInfo m = type.GetMethod ("M");
3261 Type[] mArgs = m.GetGenericArguments ();
3262 Assert.AreEqual(1, tArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3263 Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3264 Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3267 [Test] //bug #471255
3268 public void GetTypeCalledUsingReflection ()
3270 Type expectedType = Type.GetType ("NoNamespaceClass");
3271 Assert.IsNotNull (expectedType, "#1");
3272 MethodInfo m = typeof (Type).GetMethod ("GetType", BindingFlags.Public | BindingFlags.Static, null, new Type [] { typeof (string) }, null);
3273 object r = m.Invoke (null, BindingFlags.Default, null, new object [] { "NoNamespaceClass" }, CultureInfo.InvariantCulture);
3274 Assert.AreSame (expectedType, r, "#2");
3277 public class BConstrained<Y> where Y : BConstrained<Y> {
3280 public class AConstrained<X> : BConstrained<AConstrained<X>> {
3283 [Test] // Bug https://bugzilla.xamarin.com/show_bug.cgi?id=54485
3284 public void MakeGenericType_GTD_Constraint ()
3286 // This is pretty weird, but match .NET behavior (note
3287 // that typeof(BConstrained<AConstrained<>>) is a
3288 // compile-time error with roslyn, but it's apparently
3289 // an ok thing to make with reflection.
3290 var tb = typeof (BConstrained<>);
3291 var ta = typeof (AConstrained<>);
3292 var result = tb.MakeGenericType (ta);
3293 Assert.IsNotNull (result, "#1");
3294 // lock down the answer to match what .NET makes
3295 Assert.IsTrue (result.IsGenericType, "#2");
3296 Assert.AreEqual (tb, result.GetGenericTypeDefinition (), "#3");
3297 var bargs = result.GetGenericArguments ();
3298 Assert.AreEqual (1, bargs.Length, "#4");
3299 var arg = bargs [0];
3300 Assert.IsTrue (arg.IsGenericType, "#5");
3301 // N.B. evidently AConstrained`1 and AConstrained`1<!0> are the same type
3302 Assert.IsTrue (arg.IsGenericTypeDefinition, "#6");
3303 Assert.AreEqual (ta, arg.GetGenericTypeDefinition (), "#7");
3304 var aargs = arg.GetGenericArguments ();
3305 Assert.AreEqual (1, aargs.Length, "#8");
3306 Assert.AreEqual (ta.GetGenericArguments () [0], aargs [0], "#9");
3310 public void EqualsUserType () {
3311 UserType2 t1 = new UserType2(null);
3312 UserType2 t2 = new UserType2(t1);
3313 Assert.IsTrue (t1.Equals(t2));
3317 public void GetHashCodeUserType () {
3318 UserType2 t1 = new UserType2(null);
3319 UserType2 t2 = new UserType2(t1);
3320 Assert.AreEqual (42, t2.GetHashCode());
3324 public void IsGenericTypeDefinitionUserType () {
3325 Assert.IsFalse (new UserType(null).IsGenericTypeDefinition);
3329 public void IsGenericTypeUserType () {
3330 Assert.IsFalse (new UserType(null).IsGenericType);
3334 [ExpectedException (typeof (NotSupportedException))]
3335 public void GetGenericTypeDefinitionUserType () {
3336 new UserType(null).GetGenericTypeDefinition ();
3339 [ExpectedException (typeof (NotSupportedException))]
3340 public void GetGenericArgumentsUserType () {
3341 new UserType(null).GetGenericArguments ();
3345 [ExpectedException (typeof (InvalidOperationException))]
3346 public void GenericParameterPositionUserType () {
3347 Assert.IsTrue (new UserType(null).GenericParameterPosition == 0);
3351 public void TypeGetMemberReturnTypeTest ()
3354 MemberTypes memtype;
3356 object [] flagsandtypes = new object [] {
3357 MemberTypes.All, typeof (MemberInfo []),
3358 MemberTypes.Constructor, typeof (ConstructorInfo []),
3359 MemberTypes.Custom, typeof (MemberInfo []),
3360 MemberTypes.Event, typeof (EventInfo []),
3361 MemberTypes.Field, typeof (FieldInfo []),
3362 MemberTypes.Method, typeof (MethodInfo []),
3363 MemberTypes.NestedType, typeof (Type []),
3364 MemberTypes.Property, typeof (PropertyInfo []),
3365 MemberTypes.TypeInfo, typeof (Type [])};
3367 for (int i=0; i < flagsandtypes.Length; i+=2) {
3368 memtype = (MemberTypes)flagsandtypes [i];
3369 testtype = (Type)flagsandtypes [i+1];
3370 obj = GetType ().GetMember ("DummyMember", memtype,
3371 BindingFlags.Public | BindingFlags.Instance);
3372 Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
3373 "Expected #" + i + " " + testtype.FullName);
3379 public void TypeNameStartsWithSpace ()
3381 Type t1 = Type.GetType ("System.Type, mscorlib");
3382 Type t2 = Type.GetType (" System.Type, mscorlib");
3383 Assert.AreEqual (t1, t2);
3386 #if !MONOTOUCH && !FULL_AOT_RUNTIME
3388 public void SpaceAfterComma () {
3389 string strType = "System.Collections.Generic.Dictionary`2[[System.Int32,mscorlib], [System.String,mscorlib]],mscorlib";
3390 Assert.IsTrue (Type.GetType (strType) != null);
3394 #if !MONOTOUCH && !FULL_AOT_RUNTIME
3396 public void Bug506757 ()
3398 AssemblyName assemblyName = new AssemblyName ();
3399 assemblyName.Name = "customMod";
3400 assemblyName.Version = new Version (1, 2, 3, 4);
3402 AssemblyBuilder assembly
3403 = Thread.GetDomain().DefineDynamicAssembly(
3404 assemblyName, AssemblyBuilderAccess.RunAndSave);
3406 ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
3408 TypeBuilder type0 = module.DefineType ("Base", TypeAttributes.Public, typeof (object));
3409 TypeBuilder type1 = module.DefineType ("Middle", TypeAttributes.Public, type0);
3410 TypeBuilder type2 = module.DefineType ("End", TypeAttributes.Public, type1);
3412 MethodAttributes attrs0 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3413 MethodAttributes.NewSlot | MethodAttributes.FamORAssem;
3415 MethodAttributes attrs1 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3416 MethodAttributes.FamORAssem;
3418 MethodAttributes attrs2 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3419 MethodAttributes.Public;
3422 MethodBuilder m0 = type0.DefineMethod ("Tst", attrs0, typeof (void), null);
3423 m0.GetILGenerator ().Emit (OpCodes.Ret);
3425 MethodBuilder m1 = type1.DefineMethod ("Tst", attrs1, typeof (void), null);
3426 m1.GetILGenerator ().Emit (OpCodes.Ret);
3428 MethodBuilder m2 = type2.DefineMethod ("Tst", attrs2, typeof (void), null);
3429 m2.GetILGenerator ().Emit (OpCodes.Ret);
3432 type0.CreateType ();
3433 type1.CreateType ();
3434 Type t2 = type2.CreateType ();
3436 foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
3437 Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
3441 public void MakeArrayTypeOfOneDimension ()
3443 Type vector = typeof (int).MakeArrayType ();
3444 Type szarray = typeof (int).MakeArrayType (1);
3446 Assert.AreNotEqual (vector, szarray, "#1");
3447 Assert.AreEqual ("Int32[]", vector.Name, "#2");
3448 Assert.AreEqual ("Int32[*]", szarray.Name, "#3");
3451 public class DeclaringMethodFoo {
3452 public void Test<T> (T t) {}
3453 public void Test2<T> (ref T t) {}
3456 public class DeclaringMethodBar<T> {
3457 public void Test2 (ref T t) {}
3461 public void DeclaringMethodOnlyWorksWithGenericArgs ()
3463 MethodInfo testMethod = typeof (DeclaringMethodFoo).GetMethod ("Test");
3464 MethodBase otherMethod = testMethod.GetParameters ()[0].ParameterType.DeclaringMethod;
3466 Assert.AreEqual (testMethod, otherMethod,"#1");
3468 Assert.IsNull (typeof (DeclaringMethodBar<>).GetGenericArguments ()[0].DeclaringMethod, "#2");
3471 var x = typeof (int).DeclaringMethod;
3473 } catch (InvalidOperationException) {}
3476 var x = typeof (DeclaringMethodFoo).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3478 } catch (InvalidOperationException) {}
3481 var x = typeof (DeclaringMethodBar<>).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3483 } catch (InvalidOperationException) {}
3488 public void GetArrayRankThrowsForNonArrayType ()
3490 Assert.AreEqual (1, typeof (int[]).GetArrayRank (), "#1");
3491 Assert.AreEqual (2, typeof (int[,]).GetArrayRank (), "#2");
3493 typeof (int).GetArrayRank ();
3495 } catch (ArgumentException) {}
3498 [Test] //Bug #564379
3499 public void GetMethodsReturnPublicMethodsInInterfaces ()
3501 Type t = typeof (NonClosingStream);
3502 MethodInfo[] methods = t.GetMethods (BindingFlags.Public | BindingFlags.Instance);
3504 Assert.AreEqual (5, methods.Length, "#1");
3507 foreach (var m in methods) {
3508 if (m.Name.Equals ("ToString"))
3509 Assert.IsTrue (m.DeclaringType == typeof (NonClosingStream), "#" + id);
3510 else if (m.Name.Equals ("Dispose") && m.GetParameters ().Length == 0)
3511 Assert.IsTrue (m.DeclaringType == typeof (Stream), "#" + id);
3512 else if (m.Name.Equals ("Equals") || m.Name.Equals ("GetHashCode") || m.Name.Equals ("GetType"))
3513 Assert.IsTrue (m.DeclaringType == typeof (object), "#" + id);
3515 Assert.Fail ("invalid method " + m);
3520 [Test] // Bug #574696
3521 public void GetMember_DoesntReturnPrivatePropOfParent ()
3523 BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
3524 Assert.AreEqual (1, typeof (Bar).GetMember ("PrivInst", flags).Length);
3525 Assert.AreEqual (0, typeof (Bar).GetMember ("PrivInstBase", flags).Length);
3526 Assert.AreEqual (1, typeof (Foo).GetMember ("PrivInstBase", flags).Length);
3529 [Test] // Bug #484246
3530 public void GetInterfaceCompareAgainstGTDNames ()
3532 var t = typeof (Dictionary<string,string>);
3533 var iface = typeof (IDictionary<string,string>);
3535 Assert.AreSame (iface, t.GetInterface ("System.Collections.Generic.IDictionary`2"), "#1");
3537 string name = "System.Collections.Generic.IDictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]";
3539 Assert.IsNull (t.GetInterface (name), "#2");
3543 public void RuntimeCorrectlyNormalizeGenericTypes ()
3545 Type lst = typeof (MList<>);
3546 Type arg = lst.GetGenericArguments ()[0];
3548 Type sup = lst.BaseType;
3549 Type sa0 = sup.GetGenericArguments ()[0];
3550 Type sa1 = sup.GetGenericArguments ()[1];
3552 Assert.IsTrue (sa1 == lst, "#1");
3553 Assert.IsTrue (sa0 == arg, "#2");
3555 Type inst = typeof (Cons<,>).MakeGenericType (arg, lst.MakeGenericType (arg));
3556 Assert.IsTrue (inst == sup, "#3");
3564 class MList<A> : Cons<A, MList<A>>
3569 [Test] // Bug #331126
3570 public void IsAssignableFromWorksCorrectlyWithByRefs ()
3572 Type int_byref = typeof (int).MakeByRefType ();
3573 Type obj_byref = typeof (object).MakeByRefType ();
3574 Type long_byref = typeof (long).MakeByRefType ();
3575 Type enum1_byref = typeof (AttributeTargets).MakeByRefType ();
3576 Type enum2_byref = typeof (PlatformID).MakeByRefType ();
3577 Type uint_byref = typeof (uint).MakeByRefType ();
3578 Type string_byref = typeof (object).MakeByRefType ();
3579 Type struct0_byref = typeof (Size4).MakeByRefType ();
3580 Type struct1_byref = typeof (Size4b).MakeByRefType ();
3581 Type mvar0_byref = typeof (TypeTest).GetMethod ("Bug331126").GetGenericArguments ()[0].MakeByRefType ();
3582 Type mvar1_byref = typeof (TypeTest).GetMethod ("Bug331126").GetGenericArguments ()[1].MakeByRefType ();
3584 Assert.IsFalse (typeof (int).IsAssignableFrom (int_byref), "#1");
3585 Assert.IsFalse (int_byref.IsAssignableFrom (typeof (int)), "#2");
3586 Assert.IsFalse (obj_byref.IsAssignableFrom (long_byref), "#3");
3587 Assert.IsFalse (long_byref.IsAssignableFrom (obj_byref), "#4");
3588 Assert.IsTrue (enum1_byref.IsAssignableFrom (enum2_byref), "#5");
3589 Assert.IsTrue (enum2_byref.IsAssignableFrom (enum1_byref), "#6");
3590 Assert.IsTrue (int_byref.IsAssignableFrom (enum2_byref), "#7");
3591 Assert.IsTrue (enum2_byref.IsAssignableFrom (int_byref), "#8");
3592 Assert.IsTrue (enum2_byref.IsAssignableFrom (uint_byref), "#9");
3593 Assert.IsTrue (uint_byref.IsAssignableFrom (enum2_byref), "#10");
3594 Assert.IsTrue (int_byref.IsAssignableFrom (uint_byref), "#11");
3595 Assert.IsTrue (uint_byref.IsAssignableFrom (int_byref), "#12");
3597 Assert.IsTrue (typeof (object).IsAssignableFrom (typeof (long)), "#13");
3599 Assert.IsTrue (obj_byref.IsAssignableFrom (string_byref), "#14");
3600 Assert.IsTrue (string_byref.IsAssignableFrom (obj_byref), "#15");
3602 Assert.IsFalse (uint_byref.IsAssignableFrom (struct0_byref), "#16");
3603 Assert.IsFalse (struct0_byref.IsAssignableFrom (int_byref), "#17");
3604 Assert.IsFalse (struct0_byref.IsAssignableFrom (struct1_byref), "#18");
3606 Assert.IsFalse (obj_byref.IsAssignableFrom (mvar0_byref), "#19");
3607 Assert.IsFalse (mvar0_byref.IsAssignableFrom (mvar1_byref), "#20");
3608 Assert.IsTrue (mvar0_byref.IsAssignableFrom (mvar0_byref), "#21");
3609 Assert.IsFalse (mvar0_byref.IsAssignableFrom (obj_byref), "#22");
3612 public void Bug331126<T,K> () {}
3614 public struct Size4 {
3618 public struct Size4b {
3622 [Test] // Bug #612780
3623 public void CannotMakeDerivedTypesFromTypedByRef ()
3626 typeof (global::System.TypedReference).MakeArrayType ();
3628 } catch (TypeLoadException) { }
3631 typeof (global::System.TypedReference).MakeByRefType ();
3633 } catch (TypeLoadException) { }
3636 typeof (global::System.TypedReference).MakePointerType ();
3638 } catch (TypeLoadException) { }
3643 public void DeclaringTypeOfGenericNestedTypeInstanceIsOpen ()
3645 var type = typeof (Foo<int>.Nested<string>);
3646 Assert.AreSame (typeof (Foo<>), type.DeclaringType, "#1");
3649 interface IGetInterfaceMap<in T>
3654 class GetInterfaceMap : IGetInterfaceMap<object>
3656 public string Bar (object t)
3658 return t.GetType ().FullName;
3663 public void GetInterfaceMapWorksWithVariantIfaces ()
3665 InterfaceMapping res = typeof (GetInterfaceMap).GetInterfaceMap (typeof (IGetInterfaceMap <object>));
3666 Assert.AreEqual (typeof (IGetInterfaceMap <object>), res.InterfaceType);
3667 Assert.AreEqual (typeof (object), res.InterfaceMethods [0].GetParameters () [0].ParameterType);
3669 res = typeof (GetInterfaceMap).GetInterfaceMap (typeof (IGetInterfaceMap <string>));
3670 Assert.AreEqual (typeof (IGetInterfaceMap <string>), res.InterfaceType);
3671 Assert.AreEqual (typeof (string), res.InterfaceMethods [0].GetParameters () [0].ParameterType);
3675 public class MyType : TypeDelegator {
3678 public override bool Equals (Type t) {
3680 return base.Equals (t);
3683 public override Type UnderlyingSystemType {
3686 return typeof (int);
3692 public void NewV4EqualsBehavior ()
3694 var ta = new MyType ();
3695 var tb = new MyType ();
3696 object a = ta, b = tb;
3699 Assert.AreEqual (1, ta.eq, "#1");
3700 Assert.AreEqual (2, ta.ust, "#2");
3702 Assert.AreEqual (2, ta.eq, "#3");
3703 Assert.AreEqual (3, ta.ust, "#4");
3704 Assert.AreEqual (0, tb.eq, "#5");
3705 Assert.AreEqual (1, tb.ust, "#6");
3708 public enum MyRealEnum : short {
3713 public enum MyRealEnum2 : byte {
3717 public enum MyRealEnum3 : short {
3721 public class MyEnum : TypeDelegator {
3722 public bool is_enum { get; set; }
3723 public int fields { get; set; }
3725 public override bool IsSubclassOf (Type c) {
3726 return c == typeof (Enum) && is_enum;
3729 public override FieldInfo[] GetFields (BindingFlags bindingAttr) {
3732 FieldInfo[] res = new FieldInfo [fields];
3733 for (int i = 0; i < fields; ++i) {
3734 if ((bindingAttr & BindingFlags.Instance) != 0)
3735 res [i] = typeof (MyRealEnum).GetField ("value__");
3737 res [i] = typeof (MyRealEnum).GetField ("A");
3744 public void GetEnumUnderlyingType () {
3747 new MyEnum () { is_enum = false }.GetEnumUnderlyingType ();
3749 } catch (ArgumentException) {}
3752 new MyEnum () { is_enum = true, fields = 0 }.GetEnumUnderlyingType ();
3754 } catch (ArgumentException) {}
3757 new MyEnum () { is_enum = true, fields = 2 }.GetEnumUnderlyingType ();
3759 } catch (ArgumentException) {}
3761 Assert.AreSame (typeof (short), new MyEnum () { is_enum = true, fields = 1 }.GetEnumUnderlyingType ());
3765 public void GetEnumNames () {
3767 new MyEnum () { is_enum = false }.GetEnumNames ();
3769 } catch (ArgumentException) {}
3771 var res = new MyEnum () { is_enum = true, fields = 1 }.GetEnumNames ();
3772 Assert.AreEqual (1, res.Length, "#2");
3773 Assert.AreEqual ("A", res [0], "#3");
3775 res = typeof (MyRealEnum).GetEnumNames ();
3776 Assert.AreEqual (3, res.Length, "#4");
3777 Assert.AreEqual ("A", res [0], "#5");
3778 Assert.AreEqual ("B", res [1], "#6");
3779 Assert.AreEqual ("C", res [2], "#7");
3782 public enum OutOfOrderEnum : sbyte
3784 D = -1, C = 2, B = 1, A = 0
3788 public void GetEnumNamesSortsByUnsignedValue ()
3790 string[] names = typeof (OutOfOrderEnum).GetEnumNames ();
3791 Assert.AreEqual (4, names.Length);
3792 Assert.AreEqual ("A", names [0]);
3793 Assert.AreEqual ("B", names [1]);
3794 Assert.AreEqual ("C", names [2]);
3795 Assert.AreEqual ("D", names [3]);
3799 public void GetEnumValues () {
3801 new MyEnum () { is_enum = false }.GetEnumValues ();
3803 } catch (ArgumentException) {}
3806 new MyEnum () { is_enum = true }.GetEnumValues ();
3808 } catch (NotImplementedException) {}
3810 var array = typeof (MyRealEnum).GetEnumValues ();
3811 Assert.AreEqual (typeof (MyRealEnum[]), array.GetType (), "#3");
3812 MyRealEnum[] res = (MyRealEnum[])array;
3814 Assert.AreEqual (3, res.Length, "#4");
3815 Assert.AreEqual (MyRealEnum.A, res [0], "#5");
3816 Assert.AreEqual (MyRealEnum.B, res [1], "#6");
3817 Assert.AreEqual (MyRealEnum.C, res [2], "#7");
3821 public void GetEnumValue () {
3823 typeof (MyRealEnum).GetEnumName (null);
3825 } catch (ArgumentException) { }
3828 new MyEnum () { is_enum = false }.GetEnumName (99);
3830 } catch (ArgumentException) { }
3833 Assert.IsNull (new MyEnum () { fields = 1, is_enum = true }.GetEnumName (77), "#3");
3834 Assert.AreEqual ("A", new MyEnum () { fields = 1, is_enum = true }.GetEnumName (0), "#4");
3835 Assert.AreEqual ("A", new MyEnum () { fields = 1, is_enum = true }.GetEnumName (MyRealEnum.A), "#5");
3836 Assert.AreEqual ("A", new MyEnum () { fields = 1, is_enum = true }.GetEnumName (MyRealEnum2.A), "#6");
3838 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName (MyRealEnum.A), "#7");
3839 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((short)0), "#8");
3840 Assert.AreEqual ("C", typeof (MyRealEnum).GetEnumName (2), "#9");
3841 Assert.IsNull (typeof (MyRealEnum).GetEnumName (9), "#10");
3843 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((byte)0), "#11");
3844 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((sbyte)0), "#12");
3845 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName (false), "#13");
3846 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((short)0), "#14");
3847 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((ushort)0), "#15");
3848 Assert.IsNull (typeof (MyRealEnum).GetEnumName ('c'), "#16");
3850 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((int)0), "#17");
3851 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((uint)0), "#18");
3853 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((long)0), "#19");
3854 Assert.AreEqual ("A", typeof (MyRealEnum).GetEnumName ((ulong)0), "#20");
3857 typeof (MyRealEnum).GetEnumName ((float)0);
3858 Assert.Fail ("#21");
3859 } catch (ArgumentException) { }
3861 typeof (MyRealEnum).GetEnumName ((double)0);
3862 Assert.Fail ("#22");
3863 } catch (ArgumentException) { }
3866 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((byte)0), "#23");
3867 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((sbyte)0), "#24");
3868 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName (false), "#25");
3870 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((short)0), "#26");
3871 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((ushort)0), "#27");
3873 Assert.IsNull (typeof (MyRealEnum2).GetEnumName ('c'), "#28");
3875 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((int)0), "#29");
3876 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((uint)0), "#30");
3878 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((long)0), "#31");
3879 Assert.AreEqual ("A", typeof (MyRealEnum2).GetEnumName ((ulong)0), "#32");
3882 typeof (MyRealEnum2).GetEnumName ((float)0);
3883 Assert.Fail ("#33");
3884 } catch (ArgumentException) { }
3886 typeof (MyRealEnum2).GetEnumName ((double)0);
3887 Assert.Fail ("#34");
3888 } catch (ArgumentException) { }
3890 Assert.IsNull (typeof (MyRealEnum2).GetEnumName (12345), "#35");
3894 public void IsEnumDefined () {
3896 typeof (MyRealEnum).IsEnumDefined (null);
3898 } catch (ArgumentException) { }
3901 new MyEnum () { is_enum = false }.IsEnumDefined (99);
3903 } catch (ArgumentException) { }
3906 typeof (MyRealEnum).IsEnumDefined (0);
3908 } catch (ArgumentException) { }
3911 typeof (MyRealEnum).IsEnumDefined ((ushort)0);
3913 } catch (ArgumentException) { }
3916 typeof (MyRealEnum).IsEnumDefined (MyRealEnum3.A);
3918 } catch (ArgumentException) { }
3921 typeof (MyRealEnum).IsEnumDefined (true);
3923 } catch (ArgumentException) { }
3926 typeof (MyRealEnum).IsEnumDefined (MyRealEnum2.A);
3928 } catch (ArgumentException) { }
3931 typeof (MyRealEnum).IsEnumDefined (typeof (MyRealEnum));
3933 } catch (InvalidOperationException) { }
3935 Assert.IsTrue (typeof (MyRealEnum).IsEnumDefined ((short)0), "#9");
3936 Assert.IsFalse (typeof (MyRealEnum).IsEnumDefined ((short)88), "#10");
3937 Assert.IsTrue (typeof (MyRealEnum).IsEnumDefined (MyRealEnum.A), "#11");
3938 Assert.IsFalse (typeof (MyRealEnum).IsEnumDefined ("d"), "#12");
3939 Assert.IsTrue (typeof (MyRealEnum).IsEnumDefined ("A"), "#13");
3940 Assert.IsFalse (new MyEnum () { is_enum = true, fields = 1 }.IsEnumDefined ((short)99), "#14");
3945 public class Outer {
3946 public class Inner {}
3950 public class Outer<T> {
3951 public class Inner {}
3955 public void GetTypeWithDelegates () {
3956 var tname = typeof (MyRealEnum).AssemblyQualifiedName;
3957 var res = Type.GetType (tname, name => {
3958 return Assembly.Load (name);
3959 },(asm,name,ignore) => {
3960 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
3962 Assert.AreEqual (typeof (MyRealEnum), res, "#1");
3965 tname = typeof (Dictionary<int, string>).AssemblyQualifiedName;
3966 res = Type.GetType (tname, name => {
3967 return Assembly.Load (name);
3968 },(asm,name,ignore) => {
3969 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
3971 Assert.AreEqual (typeof (Dictionary<int, string>), res, "#2");
3974 tname = typeof (Foo<int>).AssemblyQualifiedName;
3975 res = Type.GetType (tname, name => {
3976 return Assembly.Load (name);
3977 },(asm,name,ignore) => {
3978 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
3980 Assert.AreEqual (typeof (Foo<int>), res, "#3");
3983 tname = typeof (Outer.Inner).AssemblyQualifiedName;
3984 res = Type.GetType (tname, name => {
3985 return Assembly.Load (name);
3986 },(asm,name,ignore) => {
3987 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
3989 Assert.AreEqual (typeof (Outer.Inner), res, "#4");
3992 tname = typeof (Outer<double>.Inner).AssemblyQualifiedName;
3993 res = Type.GetType (tname, name => {
3994 return Assembly.Load (name);
3995 },(asm,name,ignore) => {
3996 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
3998 Assert.AreEqual (typeof (Outer<double>.Inner), res, "#5");
4001 tname = "System.Collections.Generic.List`1[System.Int32]";
4002 res = Type.GetType (tname, name => {
4003 return Assembly.Load (name);
4004 },(asm,name,ignore) => {
4005 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4007 Assert.AreEqual (typeof (List<int>), res, "#6");
4010 tname = typeof (Foo<>).FullName + "[,][]";
4011 res = Type.GetType (tname, name => {
4012 Console.WriteLine ("resolve-asm name {0}", name);
4013 return Assembly.Load (name);
4014 },(asm,name,ignore) => {
4015 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4017 Assert.AreEqual (typeof (Foo<>).MakeArrayType (2).MakeArrayType (), res, "#7");
4019 tname = string.Format("{0}[{1}][]*&", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName);
4020 res = Type.GetType (tname, name => {
4021 return Assembly.Load (name);
4022 },(asm,name,ignore) => {
4023 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4025 Assert.AreEqual (typeof (Foo<MyRealEnum>[]).MakePointerType ().MakeByRefType (), res, "#8");
4028 tname = typeof (MyRealEnum).FullName + "[][]";
4029 res = Type.GetType (tname, name => {
4030 return Assembly.Load (name);
4031 },(asm,name,ignore) => {
4032 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4034 Assert.AreEqual (typeof (MyRealEnum[][]), res, "#9");
4037 tname = typeof (MyRealEnum).FullName + "[*]";
4038 res = Type.GetType (tname, name => {
4039 return Assembly.Load (name);
4040 },(asm,name,ignore) => {
4041 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4043 Assert.AreEqual (typeof (MyRealEnum).MakeArrayType (1), res, "#10");
4046 tname = typeof (MyRealEnum).FullName + "&";
4047 res = Type.GetType (tname, name => {
4048 return Assembly.Load (name);
4049 },(asm,name,ignore) => {
4050 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4052 Assert.AreEqual (typeof (MyRealEnum).MakeByRefType (), res, "#11");
4055 tname = typeof (MyRealEnum).FullName + "*";
4056 res = Type.GetType (tname, name => {
4057 return Assembly.Load (name);
4058 },(asm,name,ignore) => {
4059 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4061 Assert.AreEqual (typeof (MyRealEnum).MakePointerType (), res, "#12");
4063 tname = typeof (MyRealEnum).FullName + "*&";
4064 res = Type.GetType (tname, name => {
4065 return Assembly.Load (name);
4066 },(asm,name,ignore) => {
4067 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4069 Assert.AreEqual (typeof (MyRealEnum).MakePointerType ().MakeByRefType(),
4072 tname = typeof (MyRealEnum).FullName + "[,]&";
4073 res = Type.GetType (tname, name => {
4074 return Assembly.Load (name);
4075 },(asm,name,ignore) => {
4076 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4078 Assert.AreEqual (typeof (MyRealEnum).MakeArrayType (2).MakeByRefType (),
4081 tname = typeof (MyRealEnum).FullName + "*[]";
4082 res = Type.GetType (tname, name => {
4083 return Assembly.Load (name);
4084 },(asm,name,ignore) => {
4085 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4087 Assert.AreEqual (typeof (MyRealEnum).MakePointerType().MakeArrayType(),
4090 // not a very useful type, but ought to be parsed correctly
4091 tname = typeof (MyRealEnum).FullName + "[]**[]*&";
4092 res = Type.GetType (tname, name => {
4093 return Assembly.Load (name);
4094 },(asm,name,ignore) => {
4095 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4097 Assert.AreEqual (typeof (MyRealEnum).MakeArrayType().MakePointerType().MakePointerType().MakeArrayType().MakePointerType().MakeByRefType(),
4100 // assembly resolve without type resolve
4101 res = Type.GetType ("System.String,mscorlib", delegate (AssemblyName aname) { return typeof (int).Assembly; }, null);
4102 Assert.AreEqual (typeof (string), res);
4106 public class CustomGetType : TypeDelegator {
4109 public CustomGetType (string name) { this.name = name; }
4111 public override Type MakeGenericType (Type[] args) {
4112 return new CustomGetType ("GINST");
4115 public override Type GetNestedType(String name, BindingFlags bidingAttr) {
4116 return new CustomGetType ("NESTED");
4119 public override string ToString () { return "UT_" + name; }
4121 public override string Name {
4122 get { return "UT_" + name; }
4127 public void GetTypeWithDelegatesAndUserTypes ()
4129 var tname = "Magic[System.Int32]";
4130 var res = Type.GetType (tname, name => {
4131 return Assembly.Load (name);
4132 },(asm,name,ignore) => {
4133 if (name == "Magic") return new CustomGetType ("MAGIC");
4134 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4136 Assert.AreEqual ("UT_GINST", res.Name, "#1");
4139 tname = "Magic+MyRealEnum";
4140 res = Type.GetType (tname, name => {
4141 return Assembly.Load (name);
4142 },(asm,name,ignore) => {
4143 if (name == "Magic") return new CustomGetType ("MAGIC");
4144 return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4146 Assert.AreEqual ("UT_NESTED", res.Name, "#2");
4149 void MustTLE (string tname) {
4151 var res = Type.GetType (tname, name => {
4152 return Assembly.Load (name);
4153 },(asm,name,ignore) => {
4154 return (object)asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4156 Assert.Fail (tname);
4157 } catch (TypeLoadException) {}
4160 void MustANE (string tname) {
4162 var res = Type.GetType (tname, name => {
4163 return Assembly.Load (name);
4164 },(asm,name,ignore) => {
4165 return (object)asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4167 Assert.Fail (tname);
4168 } catch (ArgumentNullException) {}
4171 void MustAE_general (string tname, Func<string,Type> getType) {
4173 var res = getType (tname);
4174 Assert.Fail (tname);
4175 } catch (ArgumentException) {}
4178 void MustAE (string typename) {
4179 MustAE_general (typename, tname => {
4180 return Type.GetType (tname, name => {
4181 return Assembly.Load (name);
4182 },(asm,name,ignore) => {
4183 return (object)asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4188 void MustAEnn (string typename) {
4189 MustAE_general (typename, tname => Type.GetType (tname, null, null));
4192 void MustFNFE (string tname) {
4194 var res = Type.GetType (tname, name => {
4195 return Assembly.Load (name);
4196 },(asm,name,ignore) => {
4197 return (object)asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
4199 Assert.Fail (tname);
4200 } catch (FileNotFoundException) {}
4204 public void NewGetTypeErrors () {
4206 MustAE ("!@#$%^&*");
4207 MustAE (string.Format ("{0}[{1}&]", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4208 MustAE (string.Format ("{0}[{1}*]", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4209 MustAE (string.Format ("{0}&&", typeof (MyRealEnum).FullName));
4210 MustAE (string.Format ("{0}&*", typeof (MyRealEnum).FullName));
4211 MustAE (string.Format ("{0}&[{1}]", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4212 MustAE (string.Format ("{0}[,", typeof (MyRealEnum).FullName));
4213 MustAE (string.Format ("{0}[*", typeof (MyRealEnum).FullName));
4215 MustAE (string.Format ("{0}[[{1},", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4216 MustAE (string.Format ("{0}[[{1}]", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4217 MustAE (string.Format ("{0}[[{1}],", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4218 MustAE (string.Format ("{0}[[{1}]_", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4220 MustAE (string.Format ("{0}[{1}", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4221 MustAE (string.Format ("{0}[{1},", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4222 MustAE (string.Format ("{0}[{1},,", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4223 MustAE (string.Format ("{0}[{1} (", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4224 MustAE (string.Format ("{0}[", typeof (Foo<>).FullName));
4226 MustAE (string.Format ("{0}[**]", typeof (MyRealEnum).FullName));
4227 MustAE (string.Format ("{0}[*,*]", typeof (MyRealEnum).FullName));
4228 MustAE (string.Format ("{0}[*,]", typeof (MyRealEnum).FullName));
4229 MustAE (string.Format ("{0}[,*]", typeof (MyRealEnum).FullName));
4230 MustAE (string.Format ("{0}[,-]", typeof (MyRealEnum).FullName));
4231 MustAE (string.Format ("{0}[,{0}]", typeof (MyRealEnum).FullName));
4233 MustAE (string.Format ("{0}[{1}]]", typeof (Foo<>).FullName, typeof (MyRealEnum).FullName));
4234 MustAE (string.Format ("{0}[,]]", typeof (MyRealEnum).FullName));
4237 string aqn = typeof (MyRealEnum).Assembly.FullName;
4238 MustFNFE (string.Format ("{0}, ZZZ{1}", typeof (MyRealEnum).FullName, aqn));
4239 MustTLE (string.Format ("{0}ZZZZ", typeof (MyRealEnum).FullName));
4240 MustTLE (string.Format ("{0}ZZZZ,{1}", typeof (MyRealEnum).FullName, aqn));
4244 public void GetTypeExceptionMsg () {
4245 string typeName = "system.int32, foo";
4247 Type.GetType(typeName, true, false);
4248 } catch (TypeLoadException ex) {
4249 Assert.IsTrue (ex.Message.Contains ("system.int32"));
4250 Assert.IsTrue (ex.Message.Contains ("foo"));
4254 delegate void MyAction<in T>(T ag);
4256 [Test] //bug #668506
4257 public void IsAssignableFromWithVariantDelegate () {
4258 Assert.IsFalse (typeof(MyAction<string>).IsAssignableFrom(typeof(MyAction<>)), "#1");
4262 public void IsAssignableFromWithNullable () {
4263 Console.WriteLine(typeof(IEnumerable<int?>).IsAssignableFrom(typeof(IEnumerable<int>)));
4267 public void GetTypeParseGenericCorrectly () { //Bug #15124
4268 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1"), typeof (Foo<>), "#1");
4269 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32]"), typeof (Foo<int>), "#2");
4270 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[[System.Int32]]"), typeof (Foo<int>), "#3");
4271 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32][]"), typeof (Foo<int>[]), "#4");
4272 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[][System.Int32]"), null, "#5");
4273 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32][,]"), typeof (Foo<int>[,]), "#6");
4274 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[]"), typeof (Foo<>).MakeArrayType(), "#7");
4275 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[,]"), typeof (Foo<>).MakeArrayType (2), "#8");
4276 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[][]"), typeof (Foo<>).MakeArrayType ().MakeArrayType (), "#9");
4277 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1["), null, "#10");
4278 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[["), null, "#11");
4279 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[[]"), null, "#12");
4280 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[,"), null, "#13");
4281 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[*"), null, "#14");
4282 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32"), null, "#15");
4286 public void GetTypeNullDelegatesParseGenericCorrectly () {
4287 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1", null, null), typeof (Foo<>), "#1");
4288 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32]", null, null), typeof (Foo<int>), "#2");
4289 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[[System.Int32]]", null, null), typeof (Foo<int>), "#3");
4290 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32][]", null, null), typeof (Foo<int>[]), "#4");
4291 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32][,]", null, null), typeof (Foo<int>[,]), "#5");
4292 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[]", null, null), typeof (Foo<>).MakeArrayType(), "#6");
4293 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[,]", null, null), typeof (Foo<>).MakeArrayType (2), "#7");
4294 Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[][]", null, null), typeof (Foo<>).MakeArrayType ().MakeArrayType (), "#8");
4296 MustAEnn ("MonoTests.System.Foo`1[][System.Int32]");
4297 MustAEnn ("MonoTests.System.Foo`1[");
4298 MustAEnn ("MonoTests.System.Foo`1[[");
4299 MustAEnn ("MonoTests.System.Foo`1[[]");
4300 MustAEnn ("MonoTests.System.Foo`1[,");
4301 MustAEnn ("MonoTests.System.Foo`1[*");
4302 MustAEnn ("MonoTests.System.Foo`1[System.Int32");
4305 Dictionary<int, T> MakeDictHelper<T> (T[] arr) {
4306 return new Dictionary<int, T>();
4310 public void GetTypeAnonymousParseCorrectly () {
4311 var x = new { X = 1 };
4312 var a = new [] { x };
4313 var d = MakeDictHelper (a);
4315 var x_type = x.GetType ();
4316 var a_type = a.GetType ();
4317 var d_type = d.GetType ();
4319 Assert.AreEqual (Type.GetType (x_type.ToString ()), x_type, "#1");
4320 Assert.AreEqual (Type.GetType (x_type.ToString (), null, null), x_type, "#2");
4321 Assert.AreEqual (Type.GetType (a_type.ToString ()), a_type, "#3");
4322 Assert.AreEqual (Type.GetType (a_type.ToString (), null, null), a_type, "#4");
4323 Assert.AreEqual (Type.GetType (d_type.ToString ()), d_type, "#5");
4324 Assert.AreEqual (Type.GetType (d_type.ToString (), null, null), d_type, "#6");
4326 Assert.AreEqual (Type.GetType (x_type.FullName), x_type, "#7");
4327 Assert.AreEqual (Type.GetType (x_type.FullName, null, null), x_type, "#8");
4328 Assert.AreEqual (Type.GetType (a_type.FullName), a_type, "#9");
4329 Assert.AreEqual (Type.GetType (a_type.FullName, null, null), a_type, "#10");
4330 Assert.AreEqual (Type.GetType (d_type.FullName), d_type, "#11");
4331 Assert.AreEqual (Type.GetType (d_type.FullName, null, null), d_type, "#12");
4335 #if !MONOTOUCH && !FULL_AOT_RUNTIME && !MONOMAC
4337 [Category ("AndroidNotWorking")] // requires symbol writer
4338 public void FullNameGetTypeParseEscapeRoundtrip () // bug #26384
4340 var nm = new AssemblyName ("asm");
4341 var ab = AssemblyBuilder.DefineDynamicAssembly (nm,
4342 AssemblyBuilderAccess.Run);
4343 var mb = ab.DefineDynamicModule("m", false);
4344 var tb = mb.DefineType ("NameSpace,+*&[]\\.Type,+*&[]\\",
4345 TypeAttributes.Class | TypeAttributes.Public);
4347 var nestedTb = tb.DefineNestedType("Nested,+*&[]\\",
4348 TypeAttributes.Class | TypeAttributes.NestedPublic);
4350 var ty = tb.CreateType();
4352 var nestedTy = nestedTb.CreateType();
4354 var escapedNestedName =
4355 "NameSpace\\,\\+\\*\\&\\[\\]\\\\"
4357 + "Type\\,\\+\\*\\&\\[\\]\\\\"
4359 + "Nested\\,\\+\\*\\&\\[\\]\\\\";
4361 Assert.AreEqual(escapedNestedName, nestedTy.FullName);
4363 var lookupNestedTy =
4364 Type.GetType(escapedNestedName + "," + nm.FullName,
4366 if (asmName.FullName.Equals(nm.FullName)) return ab;
4367 else return Assembly.Load (asmName);
4369 (asm,name,ignore) => {
4371 return Type.GetType(name, true, ignore);
4372 else return asm.GetType(name, true, ignore);
4376 Assert.AreEqual(nestedTy, lookupNestedTy);
4383 public void GetTypeBadArity()
4385 // Regression test for #46250
4387 Type.GetType ("System.Collections.Generic.Dictionary`2[System.String]", true);
4388 Assert.Fail ("Did not throw an exception (#1)");
4389 } catch (ArgumentException) {
4393 Type.GetType ("System.Collections.Generic.Dictionary`2[System.String,System.Int32,System.Int64]", true);
4394 Assert.Fail ("Did not throw an exception (#2)");
4395 } catch (ArgumentException) {
4399 public abstract class Stream : IDisposable
4401 public void Dispose ()
4403 Console.WriteLine ("stream::dispose");
4406 protected virtual void Dispose (bool disposing)
4411 public class NonClosingStream
4412 : Stream, IDisposable
4414 void IDisposable.Dispose()
4416 Console.WriteLine ("ncs::dispose");
4419 public override string ToString () { return ""; }
4422 static bool ContainsProperty (PropertyInfo [] props, string name)
4424 foreach (PropertyInfo p in props)
4430 public class NemerleAttribute : Attribute
4434 public class VolatileModifier : NemerleAttribute
4444 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
4445 public class FooAttribute : Attribute
4449 public class BarAttribute : FooAttribute
4466 [AttributeUsage (AttributeTargets.Class, Inherited=true)]
4467 public class InheritAttribute : Attribute
4471 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
4472 public class NotInheritAttribute : InheritAttribute
4476 [NotInheritAttribute]
4477 public class bug82431A1
4481 public class bug82431A2 : bug82431A1
4485 [NotInheritAttribute]
4487 public class bug82431A3 : bug82431A1
4492 public class bug82431B1
4496 public class bug82431B2 : bug82431B1
4500 [NotInheritAttribute]
4501 public class bug82431B3 : bug82431B2
4505 public class bug82431B4 : bug82431B3
4513 public class Bug77367
4515 public void Run (bool b)
4522 private string PrivInstBlue
4524 get { return null; }
4527 protected string ProtInstBlue
4529 get { return null; }
4532 protected internal string ProIntInstBlue
4534 get { return null; }
4537 public long PubInstBlue
4541 if (PrivInstBlue == null)
4543 return long.MaxValue;
4547 internal int IntInstBlue
4552 private static string PrivStatBlue
4554 get { return null; }
4557 protected static string ProtStatBlue
4559 get { return null; }
4562 protected static internal string ProIntStatBlue
4564 get { return null; }
4567 public static long PubStatBlue
4571 if (PrivStatBlue == null)
4573 return long.MaxValue;
4577 internal static int IntStatBlue
4583 public class Foo : Blue
4585 private string PrivInstBase
4587 get { return null; }
4590 protected string ProtInstBase
4592 get { return null; }
4595 protected internal string ProIntInstBase
4597 get { return null; }
4600 public long PubInstBase
4604 if (PrivInstBase == null)
4606 return long.MaxValue;
4610 internal int IntInstBase
4615 private static string PrivStatBase
4617 get { return null; }
4620 protected static string ProtStatBase
4622 get { return null; }
4625 protected static internal string ProIntStatBase
4627 get { return null; }
4630 public static long PubStatBase
4634 if (PrivStatBase == null)
4636 return long.MaxValue;
4640 internal static int IntStatBase
4646 public class Bar : Foo
4648 private string PrivInst
4650 get { return null; }
4653 protected string ProtInst
4655 get { return null; }
4658 protected internal string ProIntInst
4660 get { return null; }
4667 if (PrivInst == null)
4669 return long.MaxValue;
4673 internal int IntInst
4678 private static string PrivStat
4680 get { return null; }
4683 protected static string ProtStat
4685 get { return null; }
4688 protected static internal string ProIntStat
4690 get { return null; }
4693 public static long PubStat
4697 if (PrivStat == null)
4699 return long.MaxValue;
4703 internal static int IntStat
4729 public CtorsC (int x)
4735 class UserType : Type
4737 protected Type type;
4739 public UserType(Type type) {
4743 public override Type UnderlyingSystemType { get { return this.type; } }
4745 public override Assembly Assembly { get { return this.type == null ? null : this.type.Assembly; } }
4747 public override string AssemblyQualifiedName { get { return null; } }
4749 public override Type BaseType { get { return null; } }
4751 public override Module Module { get { return this.type.Module; } }
4753 public override string Namespace { get { return null; } }
4755 public override bool IsGenericParameter { get { return true; } }
4757 public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
4759 public override bool ContainsGenericParameters { get { return true; } }
4761 public override string FullName { get { return this.type.Name; } }
4763 public override Guid GUID { get { throw new NotSupportedException(); } }
4766 protected override bool IsArrayImpl() {
4770 protected override bool IsByRefImpl()
4775 protected override bool IsCOMObjectImpl()
4780 protected override bool IsPointerImpl()
4785 protected override bool IsPrimitiveImpl()
4791 protected override TypeAttributes GetAttributeFlagsImpl()
4796 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
4797 CallingConventions callConvention, Type[] types,
4798 ParameterModifier[] modifiers)
4803 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
4808 public override Type GetElementType()
4813 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
4819 public override FieldInfo GetField(string name, BindingFlags bindingAttr)
4825 public override Type GetInterface(string name, bool ignoreCase)
4830 public override Type[] GetInterfaces()
4835 public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
4840 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
4845 public override object[] GetCustomAttributes(bool inherit)
4850 public override bool IsDefined(Type attributeType, bool inherit)
4855 public override string Name { get { return this.type.Name; } }
4857 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
4859 throw new NotImplementedException();
4862 public override FieldInfo[] GetFields(BindingFlags bindingAttr)
4864 throw new NotImplementedException();
4867 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
4868 CallingConventions callConvention, Type[] types,
4869 ParameterModifier[] modifiers)
4874 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
4879 public override Type GetNestedType(string name, BindingFlags bindingAttr)
4884 public override Type[] GetNestedTypes(BindingFlags bindingAttr)
4889 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
4894 protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder,
4895 Type returnType, Type[] types, ParameterModifier[] modifiers)
4900 protected override bool HasElementTypeImpl()
4905 public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target,
4906 object[] args, ParameterModifier[] modifiers, CultureInfo culture,
4907 string[] namedParameters)
4909 throw new NotSupportedException();
4913 class UserType2 : UserType {
4914 public UserType2 (Type type) : base (type) {
4917 public override Type UnderlyingSystemType { get { return this.type ?? this; } }
4919 public override int GetHashCode()
4923 return type.GetHashCode();