1 // TypeTest.cs - NUnit Test Cases for the System.Type class
4 // Zoltan Varga (vargaz@freemail.hu)
7 // (C) 2003 Ximian, Inc. http://www.ximian.com
10 using NUnit.Framework;
12 using System.Threading;
13 using System.Collections;
14 using System.Collections.Generic;
16 using System.Reflection;
17 using System.Reflection.Emit;
18 using System.Runtime.InteropServices;
20 using System.Globalization;
22 class NoNamespaceClass {
25 namespace MonoTests.System
27 class Super : ICloneable
29 public virtual object Clone ()
44 interface IFace2 : IFace1
49 interface IFace3 : IFace2
64 public abstract int this [byte i] {
68 public abstract int this [int i] {
72 public abstract void TestVoid ();
73 public abstract void TestInt (int i);
76 class DeriveVTable : Base
78 public override int this [byte i] {
82 public override int this [int i] {
86 public override void TestVoid ()
91 public override void TestInt (int i)
97 class NewVTable : DeriveVTable
99 public new int this [byte i] {
103 public new int this [int i] {
107 public new void TestVoid ()
112 public new void TestInt (int i)
117 public void Overload ()
121 public void Overload (int i)
125 public NewVTable (out int i)
130 public void byref_method (out int i)
138 public virtual int Foo {
144 class Derived1 : Base1
146 public override int Foo {
151 class Derived2 : Base1
164 get { throw new NotImplementedException (); }
167 public T Execute (T a)
177 public interface IBar<T>
181 public class Baz<T> : IBar<T>
187 public static void Bang<S> () {}
190 public class Bug348522
192 public void Test (int __argument)
197 public class FirstMethodBinder : Binder
199 public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase [] match, ref object [] args,
200 ParameterModifier [] modifiers, CultureInfo culture, string [] names,
207 public override object ChangeType (object value, Type type1, CultureInfo culture)
212 // The rest is just to please the compiler
213 public override FieldInfo BindToField (BindingFlags a, FieldInfo[] b, object c, CultureInfo d)
218 public override void ReorderArgumentArray(ref object[] a, object b)
222 public override MethodBase SelectMethod(BindingFlags a, MethodBase[] b, Type[] c, ParameterModifier[] d)
227 public override PropertyInfo SelectProperty(BindingFlags a, PropertyInfo[] b, Type c, Type[] d, ParameterModifier[] e)
235 public class TypeTest
237 private AssemblyBuilder assembly;
238 private ModuleBuilder module;
239 const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
240 static int typeIndexer = 0;
245 AssemblyName assemblyName = new AssemblyName ();
246 assemblyName.Name = ASSEMBLY_NAME;
247 assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
248 assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
249 module = assembly.DefineDynamicModule ("module1");
252 private string genTypeName ()
254 return "t" + (typeIndexer++);
257 private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k)
261 private void GenericMethod<Q> (Q q)
266 public void TestIsAssignableFrom ()
268 // Simple tests for inheritance
269 Assert.AreEqual (typeof (Super).IsAssignableFrom (typeof (Duper)) , true, "#01");
270 Assert.AreEqual (typeof (Duper).IsAssignableFrom (typeof (Duper)), true, "#02");
271 Assert.AreEqual (typeof (Object).IsAssignableFrom (typeof (Duper)), true, "#03");
272 Assert.AreEqual (typeof (ICloneable).IsAssignableFrom (typeof (Duper)), true, "#04");
275 Assert.AreEqual (typeof (Super[]).IsAssignableFrom (typeof (Duper[])), true, "#05");
276 Assert.AreEqual (typeof (Duper[]).IsAssignableFrom (typeof (Super[])), false, "#06");
277 Assert.AreEqual (typeof (Object[]).IsAssignableFrom (typeof (Duper[])), true, "#07");
278 Assert.AreEqual (typeof (ICloneable[]).IsAssignableFrom (typeof (Duper[])), true, "#08");
280 // Tests for multiple dimensional arrays
281 Assert.AreEqual (typeof (Super[][]).IsAssignableFrom (typeof (Duper[][])), true, "#09");
282 Assert.AreEqual (typeof (Duper[][]).IsAssignableFrom (typeof (Super[][])), false, "#10");
283 Assert.AreEqual (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])), true, "#11");
284 Assert.AreEqual (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])), true, "#12");
286 // Tests for vectors<->one dimensional arrays */
287 #if TARGET_JVM // Lower bounds arrays are not supported for TARGET_JVM.
288 Array arr1 = Array.CreateInstance (typeof (int), new int[] {1});
289 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
291 Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
292 Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
294 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
295 Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false, "#14");
298 // Test that arrays of enums can be cast to their base types
299 Assert.AreEqual (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])), true, "#15");
301 // Test that arrays of valuetypes can't be cast to arrays of
303 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TypeCode[])), false, "#16");
304 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TypeCode[])), false, "#17");
305 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TypeCode[])), false, "#18");
307 // Test that arrays of enums can't be cast to arrays of references
308 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TheEnum[])), false, "#19");
309 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TheEnum[])), false, "#20");
310 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TheEnum[])), false, "#21");
312 // Check that ValueType and Enum are recognized as reference types
313 Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (ValueType)), true, "#22");
314 Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (Enum)), true, "#23");
315 Assert.AreEqual (typeof (ValueType).IsAssignableFrom (typeof (Enum)), true, "#24");
317 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (ValueType[])), true, "#25");
318 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (ValueType[])), true, "#26");
319 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (ValueType[])), false, "#27");
321 Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (Enum[])), true, "#28");
322 Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (Enum[])), true, "#29");
323 Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (Enum[])), true, "#30");
325 // Tests for byref types
326 MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
327 Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
328 Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
330 // Tests for type parameters
331 mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
332 Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
333 Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
337 [ExpectedException (typeof (ArgumentException))]
338 public void GetInterfaceMapOnInterface ()
340 typeof (IList).GetInterfaceMap (typeof (ICollection));
344 public void TestIsSubclassOf ()
346 Assert.IsTrue (typeof (ICloneable).IsSubclassOf (typeof (object)), "#01");
348 // Tests for byref types
349 Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
350 Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
351 //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
352 Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
356 public void TestGetMethodImpl ()
358 // Test binding of new slot methods (using no types)
359 Assert.AreEqual (typeof (Base), typeof (Base).GetMethod("TestVoid").DeclaringType, "#01");
360 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestVoid").DeclaringType, "#02");
362 // Test binding of new slot methods (using types)
363 Assert.AreEqual (typeof (Base), typeof (Base).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#03");
364 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#04");
366 // Test overload resolution
367 Assert.AreEqual (0, typeof (NewVTable).GetMethod ("Overload", new Type[0]).GetParameters ().Length, "#05");
369 // Test byref parameters
370 Assert.AreEqual (null, typeof (NewVTable).GetMethod ("byref_method", new Type[] { typeof (int) }), "#06");
371 Type byrefInt = typeof (NewVTable).GetMethod ("byref_method").GetParameters ()[0].ParameterType;
372 Assert.IsNotNull (typeof (NewVTable).GetMethod ("byref_method", new Type[] { byrefInt }), "#07");
376 [Category ("TargetJvmNotWorking")]
377 public void TestGetPropertyImpl ()
379 // Test getting property that is exact
380 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int32) }).DeclaringType, "#01");
382 // Test getting property that is not exact
383 Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int16) }).DeclaringType, "#02");
385 // Test overriding of properties when only the set accessor is overriden
386 Assert.AreEqual (1, typeof (Derived1).GetProperties ().Length, "#03");
390 public void GetProperties ()
392 // Test hide-by-name-and-signature
393 Assert.AreEqual (1, typeof (Derived2).GetProperties ().Length);
394 Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetProperties ()[0].DeclaringType);
397 [Test] // GetProperties (BindingFlags)
398 public void GetProperties_Flags ()
400 PropertyInfo [] props;
401 Type type = typeof (Bar);
404 flags = BindingFlags.Instance | BindingFlags.NonPublic;
405 props = type.GetProperties (flags);
407 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#A1");
408 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#A2");
409 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#A3");
410 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#A4");
411 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#A5");
412 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#A6");
413 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#A7");
414 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#A8");
415 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#A9");
416 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#A10");
417 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#A11");
418 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#A12");
419 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#A13");
420 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#A14");
421 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#A15");
422 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#A16");
423 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#A17");
424 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#A18");
425 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#A19");
426 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#A20");
427 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#A21");
428 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#A22");
429 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#A23");
430 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#A24");
431 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#A25");
432 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#A26");
433 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#A27");
434 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#A28");
435 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#A29");
436 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#A30");
438 flags = BindingFlags.Instance | BindingFlags.Public;
439 props = type.GetProperties (flags);
441 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#B1");
442 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#B2");
443 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#B3");
444 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#B4");
445 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#B5");
446 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#B6");
447 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#B7");
448 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#B8");
449 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#B9");
450 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#B10");
451 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#B11");
452 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#B12");
453 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#B13");
454 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#B14");
455 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#B15");
456 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#B16");
457 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#B17");
458 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#B18");
459 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#B19");
460 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#B20");
461 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#B21");
462 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#B22");
463 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#B23");
464 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#B24");
465 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#B25");
466 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#B26");
467 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#B27");
468 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#B28");
469 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#B29");
470 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#B30");
472 flags = BindingFlags.Static | BindingFlags.Public;
473 props = type.GetProperties (flags);
475 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#C1");
476 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#C2");
477 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#C3");
478 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#C4");
479 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#C5");
480 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#C6");
481 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#C7");
482 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#C8");
483 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#C9");
484 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#C10");
485 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#C11");
486 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#C12");
487 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#C13");
488 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#C14");
489 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#C15");
490 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#C16");
491 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#C17");
492 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#C18");
493 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#C19");
494 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#C20");
495 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#C21");
496 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#C22");
497 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#C23");
498 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#C24");
499 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#C25");
500 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#C26");
501 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#C27");
502 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#C28");
503 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#C29");
504 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#C30");
506 flags = BindingFlags.Static | BindingFlags.NonPublic;
507 props = type.GetProperties (flags);
509 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#D1");
510 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#D2");
511 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#D3");
512 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#D4");
513 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#D5");
514 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#D6");
515 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#D7");
516 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#D8");
517 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#D9");
518 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#D10");
519 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#D11");
520 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#D12");
521 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#D13");
522 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#D14");
523 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#D15");
524 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#D16");
525 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#D17");
526 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#D18");
527 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#D19");
528 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#D20");
529 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#D21");
530 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#D22");
531 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#D23");
532 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#D24");
533 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#D25");
534 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#D26");
535 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#D27");
536 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#D28");
537 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#D29");
538 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#D30");
540 flags = BindingFlags.Instance | BindingFlags.NonPublic |
541 BindingFlags.FlattenHierarchy;
542 props = type.GetProperties (flags);
544 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#E1");
545 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#E2");
546 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#E3");
547 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#E4");
548 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#E5");
549 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#E6");
550 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#E7");
551 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#E8");
552 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#E9");
553 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#E10");
554 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#E11");
555 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#E12");
556 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#E13");
557 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#E14");
558 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#E15");
559 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#E16");
560 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#E17");
561 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#E18");
562 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#E19");
563 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#E20");
564 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#E21");
565 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#E22");
566 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#E23");
567 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#E24");
568 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#E25");
569 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#E26");
570 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#E27");
571 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#E28");
572 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#E29");
573 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#E30");
575 flags = BindingFlags.Instance | BindingFlags.Public |
576 BindingFlags.FlattenHierarchy;
577 props = type.GetProperties (flags);
579 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#F1");
580 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#F2");
581 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#F3");
582 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#F4");
583 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#F5");
584 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#F6");
585 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#F7");
586 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#F8");
587 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#F9");
588 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#F10");
589 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#F11");
590 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#F12");
591 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#F13");
592 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#F14");
593 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#F15");
594 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#F16");
595 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#F17");
596 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#F18");
597 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#F19");
598 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#F20");
599 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#F21");
600 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#F22");
601 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#F23");
602 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#F24");
603 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#F25");
604 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#F26");
605 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#F27");
606 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#F28");
607 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#F29");
608 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#F30");
610 flags = BindingFlags.Static | BindingFlags.Public |
611 BindingFlags.FlattenHierarchy;
612 props = type.GetProperties (flags);
614 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#G1");
615 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#G2");
616 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#G3");
617 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#G4");
618 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#G5");
619 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#G6");
620 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#G7");
621 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#G8");
622 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#G9");
623 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#G10");
624 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#G11");
625 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#G12");
626 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#G13");
627 Assert.IsTrue (ContainsProperty (props, "PubStatBase"), "#G14");
628 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#G15");
629 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#G16");
630 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#G17");
631 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#G18");
632 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#G19");
633 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#G20");
634 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#G21");
635 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#G22");
636 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#G23");
637 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#G24");
638 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#G25");
639 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#G26");
640 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#G27");
641 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#G28");
642 Assert.IsTrue (ContainsProperty (props, "PubStatBlue"), "#G29");
643 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#G30");
645 flags = BindingFlags.Static | BindingFlags.NonPublic |
646 BindingFlags.FlattenHierarchy;
647 props = type.GetProperties (flags);
649 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#H1");
650 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#H2");
651 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#H3");
652 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#H4");
653 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#H5");
654 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#H6");
655 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#H7");
656 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#H8");
657 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#H9");
658 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#H10");
659 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#H11");
660 Assert.IsTrue (ContainsProperty (props, "ProtStatBase"), "#H12");
661 Assert.IsTrue (ContainsProperty (props, "ProIntStatBase"), "#H13");
662 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#H14");
663 Assert.IsTrue (ContainsProperty (props, "IntStatBase"), "#H15");
664 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#H16");
665 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#H17");
666 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#H18");
667 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#H19");
668 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#H20");
669 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#H21");
670 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#H22");
671 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#H23");
672 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#H24");
673 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#H25");
674 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#H26");
675 Assert.IsTrue (ContainsProperty (props, "ProtStatBlue"), "#H27");
676 Assert.IsTrue (ContainsProperty (props, "ProIntStatBlue"), "#H28");
677 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#H29");
678 Assert.IsTrue (ContainsProperty (props, "IntStatBlue"), "#H30");
680 flags = BindingFlags.Instance | BindingFlags.NonPublic |
681 BindingFlags.DeclaredOnly;
682 props = type.GetProperties (flags);
684 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#I1");
685 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#I2");
686 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#I3");
687 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#I4");
688 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#I5");
689 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#I6");
690 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#I7");
691 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#I8");
692 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#I9");
693 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#I10");
694 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#I11");
695 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#I12");
696 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#I13");
697 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#I14");
698 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#I15");
699 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#I16");
700 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#I17");
701 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#I18");
702 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#I19");
703 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#I20");
704 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#I21");
705 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#I22");
706 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#I23");
707 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#I24");
708 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#I25");
709 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#I26");
710 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#I27");
711 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#I28");
712 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#I29");
713 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#I30");
715 flags = BindingFlags.Instance | BindingFlags.Public |
716 BindingFlags.DeclaredOnly;
717 props = type.GetProperties (flags);
719 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#J1");
720 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#J2");
721 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#J3");
722 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#J4");
723 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#J5");
724 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#J6");
725 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#J7");
726 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#J8");
727 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#J9");
728 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#J10");
729 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#J11");
730 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#J12");
731 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#J13");
732 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#J14");
733 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#J15");
734 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#J16");
735 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#J17");
736 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#J18");
737 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#J19");
738 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#J20");
739 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#J21");
740 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#J22");
741 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#J23");
742 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#J24");
743 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#J25");
744 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#J26");
745 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#J27");
746 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#J28");
747 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#J29");
748 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#J30");
750 flags = BindingFlags.Static | BindingFlags.Public |
751 BindingFlags.DeclaredOnly;
752 props = type.GetProperties (flags);
754 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#K1");
755 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#K2");
756 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#K3");
757 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#K4");
758 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#K5");
759 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#K6");
760 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#K7");
761 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#K8");
762 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#K9");
763 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#K10");
764 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#K11");
765 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#K12");
766 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#K13");
767 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#K14");
768 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#K15");
769 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#K16");
770 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#K17");
771 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#K18");
772 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#K19");
773 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#K20");
774 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#K21");
775 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#K22");
776 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#K23");
777 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#K24");
778 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#K25");
779 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#K26");
780 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#K27");
781 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#K28");
782 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#K29");
783 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#K30");
785 flags = BindingFlags.Static | BindingFlags.NonPublic |
786 BindingFlags.DeclaredOnly;
787 props = type.GetProperties (flags);
789 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#L1");
790 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#L2");
791 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#L3");
792 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#L4");
793 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#L5");
794 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#L6");
795 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#L7");
796 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#L8");
797 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#L9");
798 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#L10");
799 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#L11");
800 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#L12");
801 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#L13");
802 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#L14");
803 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#L15");
804 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#L16");
805 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#L17");
806 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#L18");
807 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#L19");
808 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#L20");
809 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#L21");
810 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#L22");
811 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#L23");
812 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#L24");
813 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#L25");
814 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#L26");
815 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#L27");
816 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#L28");
817 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#L29");
818 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#L30");
820 flags = BindingFlags.Instance | BindingFlags.NonPublic |
822 props = type.GetProperties (flags);
824 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#M1");
825 Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#M2");
826 Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#M3");
827 Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#M4");
828 Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#M5");
829 Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#M6");
830 Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#M7");
831 Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#M8");
832 Assert.IsTrue (ContainsProperty (props, "PubInst"), "#M9");
833 Assert.IsTrue (ContainsProperty (props, "IntInst"), "#M10");
834 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#M11");
835 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#M12");
836 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#M13");
837 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#M14");
838 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#M15");
839 Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#M16");
840 Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#M17");
841 Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#M18");
842 Assert.IsFalse (ContainsProperty (props, "PubStat"), "#M19");
843 Assert.IsFalse (ContainsProperty (props, "IntStat"), "#M20");
844 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#M21");
845 Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#M22");
846 Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#M23");
847 Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#M24");
848 Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#M25");
849 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#M26");
850 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#M27");
851 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#M28");
852 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#M29");
853 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#M30");
855 flags = BindingFlags.Static | BindingFlags.NonPublic |
857 props = type.GetProperties (flags);
859 Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#N1");
860 Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#N2");
861 Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#N3");
862 Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#N4");
863 Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#N5");
864 Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#N6");
865 Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#N7");
866 Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#N8");
867 Assert.IsFalse (ContainsProperty (props, "PubInst"), "#N9");
868 Assert.IsFalse (ContainsProperty (props, "IntInst"), "#N10");
869 Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#N11");
870 Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#N12");
871 Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#N13");
872 Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#N14");
873 Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#N15");
874 Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#N16");
875 Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#N17");
876 Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#N18");
877 Assert.IsTrue (ContainsProperty (props, "PubStat"), "#N19");
878 Assert.IsTrue (ContainsProperty (props, "IntStat"), "#N20");
879 Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#N21");
880 Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#N22");
881 Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#N23");
882 Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#N24");
883 Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#N25");
884 Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#N26");
885 Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#N27");
886 Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#N28");
887 Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#N29");
888 Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#N30");
891 [Test] // GetProperty (String)
892 public void GetProperty1_Name_Null ()
894 Type type = typeof (Bar);
896 type.GetProperty ((string) null);
898 } catch (ArgumentNullException ex) {
899 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
900 Assert.IsNull (ex.InnerException, "#3");
901 Assert.IsNotNull (ex.Message, "#4");
902 Assert.IsNotNull (ex.ParamName, "#5");
903 Assert.AreEqual ("name", ex.ParamName, "#6");
907 [Test] // GetProperty (String, BindingFlags)
908 public void GetProperty2 ()
910 Type type = typeof (Bar);
913 flags = BindingFlags.Instance | BindingFlags.NonPublic;
915 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#A1");
916 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#A2");
917 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#A3");
918 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#A4");
919 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#A5");
920 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#A6");
921 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#A7");
922 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#A8");
923 Assert.IsNull (type.GetProperty ("PubInst", flags), "#A9");
924 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#A10");
925 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#A11");
926 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#A12");
927 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#A13");
928 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#A14");
929 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#A15");
930 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#A16");
931 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#A17");
932 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#A18");
933 Assert.IsNull (type.GetProperty ("PubStat", flags), "#A19");
934 Assert.IsNull (type.GetProperty ("IntStat", flags), "#A20");
935 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#A21");
936 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#A22");
937 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#A23");
938 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#A24");
939 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#A25");
940 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#A26");
941 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#A27");
942 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#A28");
943 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#A29");
944 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#A30");
946 flags = BindingFlags.Instance | BindingFlags.Public;
948 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#B1");
949 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#B2");
950 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#B3");
951 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#B4");
952 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#B5");
953 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#B6");
954 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#B7");
955 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#B8");
956 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#B9");
957 Assert.IsNull (type.GetProperty ("IntInst", flags), "#B10");
958 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#B11");
959 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#B12");
960 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#B13");
961 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#B14");
962 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#B15");
963 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#B16");
964 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#B17");
965 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#B18");
966 Assert.IsNull (type.GetProperty ("PubStat", flags), "#B19");
967 Assert.IsNull (type.GetProperty ("IntStat", flags), "#B20");
968 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#B21");
969 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#B22");
970 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#B23");
971 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#B24");
972 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#B25");
973 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#B26");
974 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#B27");
975 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#B28");
976 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#B29");
977 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#B30");
979 flags = BindingFlags.Static | BindingFlags.Public;
981 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#C1");
982 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#C2");
983 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#C3");
984 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#C4");
985 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#C5");
986 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#C6");
987 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#C7");
988 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#C8");
989 Assert.IsNull (type.GetProperty ("PubInst", flags), "#C9");
990 Assert.IsNull (type.GetProperty ("IntInst", flags), "#C10");
991 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#C11");
992 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#C12");
993 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#C13");
994 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#C14");
995 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#C15");
996 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#C16");
997 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#C17");
998 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#C18");
999 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#C19");
1000 Assert.IsNull (type.GetProperty ("IntStat", flags), "#C20");
1001 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#C21");
1002 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#C22");
1003 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#C23");
1004 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#C24");
1005 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#C25");
1006 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#C26");
1007 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#C27");
1008 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#C28");
1009 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#C29");
1010 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#C30");
1012 flags = BindingFlags.Static | BindingFlags.NonPublic;
1014 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#D1");
1015 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#D2");
1016 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#D3");
1017 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#D4");
1018 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#D5");
1019 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#D6");
1020 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#D7");
1021 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#D8");
1022 Assert.IsNull (type.GetProperty ("PubInst", flags), "#D9");
1023 Assert.IsNull (type.GetProperty ("IntInst", flags), "#D10");
1024 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#D11");
1025 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#D12");
1026 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#D13");
1027 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#D14");
1028 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#D15");
1029 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#D16");
1030 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#D17");
1031 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#D18");
1032 Assert.IsNull (type.GetProperty ("PubStat", flags), "#D19");
1033 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#D20");
1034 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#D21");
1035 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#D22");
1036 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#D23");
1037 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#D24");
1038 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#D25");
1039 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#D26");
1040 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#D27");
1041 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#D28");
1042 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#D29");
1043 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#D30");
1045 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1046 BindingFlags.FlattenHierarchy;
1048 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#E1");
1049 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#E2");
1050 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#E3");
1051 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#E4");
1052 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#E5");
1053 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#E6");
1054 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#E7");
1055 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#E8");
1056 Assert.IsNull (type.GetProperty ("PubInst", flags), "#E9");
1057 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#E10");
1058 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#E11");
1059 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#E12");
1060 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#E13");
1061 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#E14");
1062 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#E15");
1063 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#E16");
1064 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#E17");
1065 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#E18");
1066 Assert.IsNull (type.GetProperty ("PubStat", flags), "#E19");
1067 Assert.IsNull (type.GetProperty ("IntStat", flags), "#E20");
1068 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#E21");
1069 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#E22");
1070 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#E23");
1071 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#E24");
1072 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1073 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#E26");
1074 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#E27");
1075 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#E28");
1076 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#E29");
1077 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#E30");
1079 flags = BindingFlags.Instance | BindingFlags.Public |
1080 BindingFlags.FlattenHierarchy;
1082 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#F1");
1083 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#F2");
1084 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#F3");
1085 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#F4");
1086 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#F5");
1087 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#F6");
1088 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#F7");
1089 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#F8");
1090 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#F9");
1091 Assert.IsNull (type.GetProperty ("IntInst", flags), "#F10");
1092 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#F11");
1093 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#F12");
1094 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#F13");
1095 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#F14");
1096 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#F15");
1097 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#F16");
1098 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#F17");
1099 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#F18");
1100 Assert.IsNull (type.GetProperty ("PubStat", flags), "#F19");
1101 Assert.IsNull (type.GetProperty ("IntStat", flags), "#F20");
1102 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#F21");
1103 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#F22");
1104 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#F23");
1105 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#F24");
1106 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#F25");
1107 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#F26");
1108 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#F27");
1109 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#F28");
1110 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#F29");
1111 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#F30");
1113 flags = BindingFlags.Static | BindingFlags.Public |
1114 BindingFlags.FlattenHierarchy;
1116 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#G1");
1117 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#G2");
1118 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#G3");
1119 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#G4");
1120 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#G5");
1121 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#G6");
1122 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#G7");
1123 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#G8");
1124 Assert.IsNull (type.GetProperty ("PubInst", flags), "#G9");
1125 Assert.IsNull (type.GetProperty ("IntInst", flags), "#G10");
1126 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#G11");
1127 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#G12");
1128 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#G13");
1129 Assert.IsNotNull (type.GetProperty ("PubStatBase", flags), "#G14");
1130 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#G15");
1131 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#G16");
1132 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#G17");
1133 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#G18");
1134 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#G19");
1135 Assert.IsNull (type.GetProperty ("IntStat", flags), "#G20");
1136 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#G21");
1137 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#G22");
1138 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#G23");
1139 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#G24");
1140 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#G25");
1141 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#G26");
1142 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#G27");
1143 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#G28");
1144 Assert.IsNotNull (type.GetProperty ("PubStatBlue", flags), "#G29");
1145 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#G30");
1147 flags = BindingFlags.Static | BindingFlags.NonPublic |
1148 BindingFlags.FlattenHierarchy;
1150 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#H1");
1151 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#H2");
1152 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#H3");
1153 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#H4");
1154 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#H5");
1155 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#H6");
1156 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#H7");
1157 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#H8");
1158 Assert.IsNull (type.GetProperty ("PubInst", flags), "#H9");
1159 Assert.IsNull (type.GetProperty ("IntInst", flags), "#H10");
1160 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#H11");
1161 Assert.IsNotNull (type.GetProperty ("ProtStatBase", flags), "#H12");
1162 Assert.IsNotNull (type.GetProperty ("ProIntStatBase", flags), "#H13");
1163 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#H14");
1164 Assert.IsNotNull (type.GetProperty ("IntStatBase", flags), "#H15");
1165 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#H16");
1166 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#H17");
1167 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#H18");
1168 Assert.IsNull (type.GetProperty ("PubStat", flags), "#H19");
1169 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#H20");
1170 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#H21");
1171 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#H22");
1172 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#H23");
1173 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#H24");
1174 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#H25");
1175 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#H26");
1176 Assert.IsNotNull (type.GetProperty ("ProtStatBlue", flags), "#H27");
1177 Assert.IsNotNull (type.GetProperty ("ProIntStatBlue", flags), "#H28");
1178 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#H29");
1179 Assert.IsNotNull (type.GetProperty ("IntStatBlue", flags), "#H30");
1181 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1182 BindingFlags.DeclaredOnly;
1184 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#I1");
1185 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#I2");
1186 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#I3");
1187 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#I4");
1188 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#I5");
1189 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#I6");
1190 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#I7");
1191 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#I8");
1192 Assert.IsNull (type.GetProperty ("PubInst", flags), "#I9");
1193 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#I10");
1194 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#I11");
1195 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#I12");
1196 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#I13");
1197 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#I14");
1198 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#I15");
1199 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#I16");
1200 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#I17");
1201 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#I18");
1202 Assert.IsNull (type.GetProperty ("PubStat", flags), "#I19");
1203 Assert.IsNull (type.GetProperty ("IntStat", flags), "#I20");
1204 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#I21");
1205 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#I22");
1206 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#I23");
1207 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#I24");
1208 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#I25");
1209 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#I26");
1210 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#I27");
1211 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#I28");
1212 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#I29");
1213 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#I30");
1215 flags = BindingFlags.Instance | BindingFlags.Public |
1216 BindingFlags.DeclaredOnly;
1218 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#J1");
1219 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#J2");
1220 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#J3");
1221 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#J4");
1222 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#J5");
1223 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#J6");
1224 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#J7");
1225 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#J8");
1226 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#J9");
1227 Assert.IsNull (type.GetProperty ("IntInst", flags), "#J10");
1228 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#J11");
1229 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#J12");
1230 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#J13");
1231 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#J14");
1232 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#J15");
1233 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#J16");
1234 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#J17");
1235 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#J18");
1236 Assert.IsNull (type.GetProperty ("PubStat", flags), "#J19");
1237 Assert.IsNull (type.GetProperty ("IntStat", flags), "#J20");
1238 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#J21");
1239 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#J22");
1240 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#J23");
1241 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#J24");
1242 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#J25");
1243 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#J26");
1244 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#J27");
1245 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#J28");
1246 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#J29");
1247 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#J30");
1249 flags = BindingFlags.Static | BindingFlags.Public |
1250 BindingFlags.DeclaredOnly;
1252 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#K1");
1253 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#K2");
1254 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#K3");
1255 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#K4");
1256 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#K5");
1257 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#K6");
1258 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#K7");
1259 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#K8");
1260 Assert.IsNull (type.GetProperty ("PubInst", flags), "#K9");
1261 Assert.IsNull (type.GetProperty ("IntInst", flags), "#K10");
1262 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#K11");
1263 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#K12");
1264 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#K13");
1265 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#K14");
1266 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#K15");
1267 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#K16");
1268 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#K17");
1269 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#K18");
1270 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#K19");
1271 Assert.IsNull (type.GetProperty ("IntStat", flags), "#K20");
1272 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#K21");
1273 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#K22");
1274 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#K23");
1275 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#K24");
1276 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#K25");
1277 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#K26");
1278 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#K27");
1279 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#K28");
1280 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#K29");
1281 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#K30");
1283 flags = BindingFlags.Static | BindingFlags.NonPublic |
1284 BindingFlags.DeclaredOnly;
1286 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#L1");
1287 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#L2");
1288 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#L3");
1289 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#L4");
1290 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#L5");
1291 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#L6");
1292 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#L7");
1293 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#L8");
1294 Assert.IsNull (type.GetProperty ("PubInst", flags), "#L9");
1295 Assert.IsNull (type.GetProperty ("IntInst", flags), "#L10");
1296 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#L11");
1297 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#L12");
1298 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#L13");
1299 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#L14");
1300 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#L15");
1301 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#L16");
1302 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#L17");
1303 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#L18");
1304 Assert.IsNull (type.GetProperty ("PubStat", flags), "#L19");
1305 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#L20");
1306 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#L21");
1307 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#L22");
1308 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#L23");
1309 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#L24");
1310 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#L25");
1311 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#L26");
1312 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#L27");
1313 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#L28");
1314 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#L29");
1315 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#L30");
1317 flags = BindingFlags.Instance | BindingFlags.NonPublic |
1318 BindingFlags.Public;
1320 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#M1");
1321 Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#M2");
1322 Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#M3");
1323 Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#M4");
1324 Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#M5");
1325 Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#M6");
1326 Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#M7");
1327 Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#M8");
1328 Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#M9");
1329 Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#M10");
1330 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#M11");
1331 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#M12");
1332 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#M13");
1333 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#M14");
1334 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#M15");
1335 Assert.IsNull (type.GetProperty ("PrivStat", flags), "#M16");
1336 Assert.IsNull (type.GetProperty ("ProtStat", flags), "#M17");
1337 Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#M18");
1338 Assert.IsNull (type.GetProperty ("PubStat", flags), "#M19");
1339 Assert.IsNull (type.GetProperty ("IntStat", flags), "#M20");
1340 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#M21");
1341 Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#M22");
1342 Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#M23");
1343 Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#M24");
1344 Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1345 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#M26");
1346 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#M27");
1347 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#M28");
1348 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#M29");
1349 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#M30");
1351 flags = BindingFlags.Static | BindingFlags.NonPublic |
1352 BindingFlags.Public;
1354 Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#N1");
1355 Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#N2");
1356 Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#N3");
1357 Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#N4");
1358 Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#N5");
1359 Assert.IsNull (type.GetProperty ("PrivInst", flags), "#N6");
1360 Assert.IsNull (type.GetProperty ("ProtInst", flags), "#N7");
1361 Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#N8");
1362 Assert.IsNull (type.GetProperty ("PubInst", flags), "#N9");
1363 Assert.IsNull (type.GetProperty ("IntInst", flags), "#N10");
1364 Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#N11");
1365 Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#N12");
1366 Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#N13");
1367 Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#N14");
1368 Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#N15");
1369 Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#N16");
1370 Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#N17");
1371 Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#N18");
1372 Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#N19");
1373 Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#N20");
1374 Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#N21");
1375 Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#N22");
1376 Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#N23");
1377 Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#N24");
1378 Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#N25");
1379 Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#N26");
1380 Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#N27");
1381 Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#N28");
1382 Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#N29");
1383 Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#N30");
1386 [Test] // GetProperty (String, BindingFlags)
1387 public void GetProperty2_Name_Null ()
1389 Type type = typeof (Bar);
1391 type.GetProperty ((string) null);
1393 } catch (ArgumentNullException ex) {
1394 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1395 Assert.IsNull (ex.InnerException, "#3");
1396 Assert.IsNotNull (ex.Message, "#4");
1397 Assert.IsNotNull (ex.ParamName, "#5");
1398 Assert.AreEqual ("name", ex.ParamName, "#6");
1402 [Test] // GetProperty (String, Type)
1403 public void GetProperty3_Name_Null ()
1405 Type type = typeof (Bar);
1407 type.GetProperty ((string) null, typeof (int));
1409 } catch (ArgumentNullException ex) {
1410 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1411 Assert.IsNull (ex.InnerException, "#3");
1412 Assert.IsNotNull (ex.Message, "#4");
1413 Assert.IsNotNull (ex.ParamName, "#5");
1414 Assert.AreEqual ("name", ex.ParamName, "#6");
1418 [Test] // GetProperty (String, Type [])
1419 public void GetProperty4_Name_Null ()
1421 Type type = typeof (Bar);
1423 type.GetProperty ((string) null, Type.EmptyTypes);
1425 } catch (ArgumentNullException ex) {
1426 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1427 Assert.IsNull (ex.InnerException, "#3");
1428 Assert.IsNotNull (ex.Message, "#4");
1429 Assert.IsNotNull (ex.ParamName, "#5");
1430 Assert.AreEqual ("name", ex.ParamName, "#6");
1434 [Test] // GetProperty (String, Type, Type [])
1435 public void GetProperty5_Name_Null ()
1437 Type type = typeof (Bar);
1439 type.GetProperty ((string) null, typeof (int),
1442 } catch (ArgumentNullException ex) {
1443 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1444 Assert.IsNull (ex.InnerException, "#3");
1445 Assert.IsNotNull (ex.Message, "#4");
1446 Assert.IsNotNull (ex.ParamName, "#5");
1447 Assert.AreEqual ("name", ex.ParamName, "#6");
1451 [Test] // GetProperty (String, Type, Type [], ParameterModifier [])
1452 public void GetProperty6_Name_Null ()
1454 Type type = typeof (Bar);
1456 type.GetProperty ((string) null, typeof (int),
1457 Type.EmptyTypes, null);
1459 } catch (ArgumentNullException ex) {
1460 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1461 Assert.IsNull (ex.InnerException, "#3");
1462 Assert.IsNotNull (ex.Message, "#4");
1463 Assert.IsNotNull (ex.ParamName, "#5");
1464 Assert.AreEqual ("name", ex.ParamName, "#6");
1468 [Test] // GetProperty (String, BindingFlags, Binder, Type, Type [], ParameterModifier [])
1469 public void GetProperty7_Name_Null ()
1471 Type type = typeof (Bar);
1473 type.GetProperty ((string) null, BindingFlags.Public,
1474 null, typeof (int), Type.EmptyTypes, null);
1476 } catch (ArgumentNullException ex) {
1477 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1478 Assert.IsNull (ex.InnerException, "#3");
1479 Assert.IsNotNull (ex.Message, "#4");
1480 Assert.IsNotNull (ex.ParamName, "#5");
1481 Assert.AreEqual ("name", ex.ParamName, "#6");
1486 public void GetProperty8_PropertyType ()
1488 Type type = typeof (Bar);
1489 Assert.IsNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance,
1490 null, typeof (int), Type.EmptyTypes, null), "#1");
1491 Assert.IsNotNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance, null,
1492 typeof (long), new Type[0], null), "#2");
1495 #if !TARGET_JVM // StructLayout not supported for TARGET_JVM
1496 [StructLayout(LayoutKind.Explicit, Pack = 4, Size = 64)]
1501 [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
1507 public void StructLayoutAttribute ()
1509 StructLayoutAttribute attr1 = typeof (TypeTest).StructLayoutAttribute;
1510 Assert.AreEqual (LayoutKind.Auto, attr1.Value);
1512 StructLayoutAttribute attr2 = typeof (Class1).StructLayoutAttribute;
1513 Assert.AreEqual (LayoutKind.Explicit, attr2.Value);
1514 Assert.AreEqual (4, attr2.Pack);
1515 Assert.AreEqual (64, attr2.Size);
1517 StructLayoutAttribute attr3 = typeof (Class2).StructLayoutAttribute;
1518 Assert.AreEqual (LayoutKind.Explicit, attr3.Value);
1519 Assert.AreEqual (CharSet.Unicode, attr3.CharSet);
1521 #endif // TARGET_JVM
1524 public void Namespace ()
1526 Assert.AreEqual (null, typeof (NoNamespaceClass).Namespace);
1530 public void GenericParameterNamespace ()
1532 var t = typeof (Foo<>).GetGenericArguments () [0];
1534 Assert.AreEqual ("T", t.Name);
1535 Assert.AreEqual ("MonoTests.System", t.Namespace);
1537 var s = typeof (Gazonk).GetMethod ("Bang").GetGenericArguments () [0];
1539 Assert.AreEqual ("S", s.Name);
1540 Assert.AreEqual ("MonoTests.System", s.Namespace);
1543 public static void Reflected (ref int a)
1550 Assert.AreEqual ("Int32&", typeof (TypeTest).GetMethod ("Reflected").GetParameters () [0].ParameterType.Name);
1551 Assert.AreEqual ("String[*]", Array.CreateInstance (typeof(string), new int[] { 1 }, new int[] { 1 }).GetType ().Name);
1555 public void GetInterfaces ()
1557 Type[] t = typeof (Duper).GetInterfaces ();
1558 Assert.AreEqual (1, t.Length);
1559 Assert.AreEqual (typeof (ICloneable), t[0]);
1561 Type[] t2 = typeof (IFace3).GetInterfaces ();
1562 Assert.AreEqual (2, t2.Length);
1568 public void GetFieldIgnoreCase ()
1570 Assert.IsNotNull (typeof (TypeTest).GetField ("afield", BindingFlags.Instance|BindingFlags.Public|BindingFlags.IgnoreCase));
1583 public void GetPropertyAccessorModifiers ()
1585 Assert.IsNotNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.Public));
1586 Assert.IsNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.NonPublic));
1590 public void IsAbstract ()
1592 Assert.IsFalse (typeof (string).IsAbstract, "#1");
1593 Assert.IsTrue (typeof (ICloneable).IsAbstract, "#2");
1594 Assert.IsTrue (typeof (ValueType).IsAbstract, "#3");
1595 Assert.IsTrue (typeof (Enum).IsAbstract, "#4");
1596 Assert.IsFalse (typeof (TimeSpan).IsAbstract, "#5");
1597 Assert.IsTrue (typeof (TextReader).IsAbstract, "#6");
1600 // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=286308
1601 Type [] typeArgs = typeof (List<>).GetGenericArguments ();
1602 Assert.IsFalse (typeArgs [0].IsAbstract, "#7");
1606 public void IsCOMObject ()
1608 Type type = typeof (string);
1609 Assert.IsFalse (type.IsCOMObject, "#1");
1611 TypeBuilder tb = module.DefineType (genTypeName ());
1612 type = tb.CreateType ();
1613 Assert.IsFalse (type.IsCOMObject, "#2");
1617 public void IsImport ()
1619 Type type = typeof (string);
1620 Assert.IsFalse (type.IsImport, "#1");
1622 TypeBuilder tb = module.DefineType (genTypeName ());
1623 type = tb.CreateType ();
1624 Assert.IsFalse (type.IsImport, "#2");
1626 tb = module.DefineType (genTypeName (), TypeAttributes.Import |
1627 TypeAttributes.Interface | TypeAttributes.Abstract);
1628 type = tb.CreateType ();
1629 Assert.IsTrue (type.IsImport, "#3");
1633 public void IsInterface ()
1635 Assert.IsFalse (typeof (string).IsInterface, "#1");
1636 Assert.IsTrue (typeof (ICloneable).IsInterface, "#2");
1640 public void IsPrimitive () {
1641 Assert.IsTrue (typeof (IntPtr).IsPrimitive, "#1");
1642 Assert.IsTrue (typeof (int).IsPrimitive, "#2");
1643 Assert.IsFalse (typeof (string).IsPrimitive, "#2");
1647 public void IsValueType ()
1649 Assert.IsTrue (typeof (int).IsValueType, "#1");
1650 Assert.IsFalse (typeof (Enum).IsValueType, "#2");
1651 Assert.IsFalse (typeof (ValueType).IsValueType, "#3");
1652 Assert.IsTrue (typeof (AttributeTargets).IsValueType, "#4");
1653 Assert.IsFalse (typeof (string).IsValueType, "#5");
1654 Assert.IsTrue (typeof (TimeSpan).IsValueType, "#6");
1658 [Category("NotDotNet")]
1659 // Depends on the GAC working, which it doesn't durring make distcheck.
1660 [Category ("NotWorking")]
1661 public void GetTypeWithWhitespace ()
1663 Assert.IsNotNull (Type.GetType
1664 (@"System.Configuration.NameValueSectionHandler,
1669 PublicKeyToken=b77a5c561934e089"));
1673 public void GetTypeNonVectorArray ()
1675 Type t = Type.GetType ("System.String[*]");
1676 Assert.AreEqual ("System.String[*]", t.ToString ());
1680 public void ExerciseFilterName ()
1682 MemberInfo[] mi = typeof(Base).FindMembers(
1684 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1685 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1686 Type.FilterName, "*");
1687 Assert.AreEqual (4, mi.Length);
1688 mi = typeof(Base).FindMembers(
1690 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1691 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1692 Type.FilterName, "Test*");
1693 Assert.AreEqual (2, mi.Length);
1694 mi = typeof(Base).FindMembers(
1696 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1697 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1698 Type.FilterName, "TestVoid");
1699 Assert.AreEqual (1, mi.Length);
1700 mi = typeof(Base).FindMembers(
1702 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1703 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1704 Type.FilterName, "NonExistingMethod");
1705 Assert.AreEqual (0, mi.Length);
1709 public void ExerciseFilterNameIgnoreCase ()
1711 MemberInfo[] mi = typeof(Base).FindMembers(
1713 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1714 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1715 Type.FilterNameIgnoreCase, "*");
1716 Assert.AreEqual (4, mi.Length);
1717 mi = typeof(Base).FindMembers(
1719 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1720 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1721 Type.FilterNameIgnoreCase, "test*");
1722 Assert.AreEqual (2, mi.Length);
1723 mi = typeof(Base).FindMembers(
1725 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1726 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1727 Type.FilterNameIgnoreCase, "TESTVOID");
1728 Assert.AreEqual (1, mi.Length);
1729 mi = typeof(Base).FindMembers(
1731 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1732 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1733 Type.FilterNameIgnoreCase, "NonExistingMethod");
1734 Assert.AreEqual (0, mi.Length);
1738 public void GenericParameterMemberType ()
1740 var t = typeof (Foo<>).GetGenericArguments () [0];
1741 Assert.IsNotNull (t);
1743 Assert.AreEqual (MemberTypes.TypeInfo, t.MemberType);
1749 public int property {
1752 public ByRef0 (int i) {}
1753 public void f (int i) {}
1757 public void ByrefTypes ()
1759 Type t = Type.GetType ("MonoTests.System.TypeTest+ByRef0&");
1760 Assert.IsNotNull (t);
1761 Assert.IsTrue (t.IsByRef);
1762 Assert.AreEqual (0, t.GetMethods (BindingFlags.Public | BindingFlags.Instance).Length);
1763 Assert.AreEqual (0, t.GetConstructors (BindingFlags.Public | BindingFlags.Instance).Length);
1764 Assert.AreEqual (0, t.GetEvents (BindingFlags.Public | BindingFlags.Instance).Length);
1765 Assert.AreEqual (0, t.GetProperties (BindingFlags.Public | BindingFlags.Instance).Length);
1767 Assert.IsNull (t.GetMethod ("f"));
1768 Assert.IsNull (t.GetField ("field"));
1769 Assert.IsNull (t.GetProperty ("property"));
1773 public void TestAssemblyQualifiedName ()
1775 Type t = Type.GetType ("System.Byte[]&");
1776 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte[]&"));
1778 t = Type.GetType ("System.Byte*&");
1779 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte*&"));
1781 t = Type.GetType ("System.Byte&");
1782 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte&"));
1791 public void CreateValueTypeNoCtor ()
1793 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, null);
1797 [ExpectedException (typeof (MissingMethodException))]
1798 public void CreateValueTypeNoCtorArgs ()
1800 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, new object [] { 1 });
1803 internal static string bug336841 (string param1, params string [] param2)
1805 StringBuilder sb = new StringBuilder ();
1809 for (int i = 0; i < param2.Length; i++) {
1812 sb.Append (param2 [i]);
1814 return sb.ToString ();
1817 internal static string bug336841 (string param1)
1819 return "#B:" + param1;
1822 internal static string bug336841 (params string [] param1)
1824 StringBuilder sb = new StringBuilder ();
1826 for (int i = 0; i < param1.Length; i++) {
1829 sb.Append (param1 [i]);
1831 return sb.ToString ();
1835 public void InvokeMember_GetSetField ()
1837 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1838 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1839 BindingFlags.SetField, null, null, new object [] { 5 });
1841 Assert.AreEqual (5, X.Value, "#A1");
1842 Assert.AreEqual (5, typeof (X).InvokeMember ("Value",
1843 BindingFlags.Public | BindingFlags.Static |
1844 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1845 null, null, new object [0]), "#A2");
1846 Assert.AreEqual (5, Y.Value, "#A3");
1847 Assert.AreEqual (5, typeof (Y).InvokeMember ("Value",
1848 BindingFlags.Public | BindingFlags.Static |
1849 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1850 null, null, new object [0]), "#A4");
1853 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1854 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1855 BindingFlags.GetField | BindingFlags.SetField,
1856 null, null, new object [] { 5 });
1857 Assert.Fail ("#B1");
1858 } catch (ArgumentException ex) {
1859 // Cannot specify both Get and Set on a field
1860 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1861 Assert.IsNull (ex.InnerException, "#B3");
1862 Assert.IsNotNull (ex.Message, "#B4");
1863 Assert.IsNotNull (ex.ParamName, "#B5");
1864 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1869 public void InvokeMember_GetSetProperty ()
1872 typeof (ArrayList).InvokeMember ("Item",
1873 BindingFlags.GetProperty | BindingFlags.SetProperty |
1874 BindingFlags.Instance | BindingFlags.Public,
1875 null, new ArrayList (), new object [] { 0, "bar" });
1877 } catch (ArgumentException ex) {
1878 // Cannot specify both Get and Set on a property
1879 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1880 Assert.IsNull (ex.InnerException, "#3");
1881 Assert.IsNotNull (ex.Message, "#4");
1882 Assert.IsNotNull (ex.ParamName, "#5");
1883 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1889 public void InvokeMember_InvokeMethod_Set ()
1892 typeof (ArrayList).InvokeMember ("ToString",
1893 BindingFlags.InvokeMethod | BindingFlags.SetField |
1894 BindingFlags.Instance | BindingFlags.Public,
1895 null, new ArrayList (), new object [0]);
1896 Assert.Fail ("#A1");
1897 } catch (ArgumentException ex) {
1898 // Cannot specify Set on a field and Invoke on a method
1899 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1900 Assert.IsNull (ex.InnerException, "#A3");
1901 Assert.IsNotNull (ex.Message, "#A4");
1902 Assert.IsNotNull (ex.ParamName, "#A5");
1903 Assert.AreEqual ("bindingFlags", ex.ParamName, "#A6");
1907 typeof (ArrayList).InvokeMember ("ToString",
1908 BindingFlags.InvokeMethod | BindingFlags.SetProperty |
1909 BindingFlags.Instance | BindingFlags.Public,
1910 null, new ArrayList (), new object [0]);
1911 Assert.Fail ("#B1");
1912 } catch (ArgumentException ex) {
1913 // Cannot specify Set on a property and Invoke on a method
1914 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1915 Assert.IsNull (ex.InnerException, "#B3");
1916 Assert.IsNotNull (ex.Message, "#B4");
1917 Assert.IsNotNull (ex.ParamName, "#B5");
1918 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1923 public void InvokeMember_MatchPrimitiveTypeWithInterface ()
1925 object [] invokeargs = { 1 };
1926 typeof (Z).InvokeMember ("", BindingFlags.DeclaredOnly |
1927 BindingFlags.Public | BindingFlags.NonPublic |
1928 BindingFlags.Instance | BindingFlags.CreateInstance,
1929 null, null, invokeargs);
1933 public void InvokeMember_Name_Null ()
1936 typeof (X).InvokeMember ((string) null,
1937 BindingFlags.Public | BindingFlags.Static |
1938 BindingFlags.FlattenHierarchy | BindingFlags.SetField,
1939 null, null, new object [] { 5 });
1941 } catch (ArgumentNullException ex) {
1942 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1943 Assert.IsNull (ex.InnerException, "#3");
1944 Assert.IsNotNull (ex.Message, "#4");
1945 Assert.IsNotNull (ex.ParamName, "#5");
1946 Assert.AreEqual ("name", ex.ParamName, "#6");
1951 public void InvokeMember_NoOperation ()
1954 typeof (TypeTest).InvokeMember ("Run", BindingFlags.Public |
1955 BindingFlags.Static, null, null, new object [0]);
1957 } catch (ArgumentException ex) {
1958 // Must specify binding flags describing the
1959 // invoke operation required
1960 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1961 Assert.IsNull (ex.InnerException, "#3");
1962 Assert.IsNotNull (ex.Message, "#4");
1963 Assert.IsNotNull (ex.ParamName, "#5");
1964 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1968 [Test] // bug #321735
1969 public void InvokeMember_SetFieldProperty ()
1971 ArrayList list = new ArrayList ();
1973 list.GetType ().InvokeMember ("Item",
1974 BindingFlags.SetField | BindingFlags.SetProperty |
1975 BindingFlags.Instance | BindingFlags.Public,
1976 null, list, new object [] { 0, "bar" });
1977 Assert.AreEqual ("bar", list [0]);
1981 public void InvokeMember_SetField_ProvidedArgs ()
1984 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1985 BindingFlags.Static | BindingFlags.SetField,
1986 null, null, new object [0]);
1987 Assert.Fail ("#A1");
1988 } catch (ArgumentException ex) {
1989 // Only the field value can be specified to set
1991 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1992 Assert.IsNull (ex.InnerException, "#A3");
1993 Assert.IsNotNull (ex.Message, "#A4");
1994 Assert.IsNotNull (ex.ParamName, "#A5");
1995 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1999 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2000 BindingFlags.Static | BindingFlags.SetField,
2002 Assert.Fail ("#B1");
2003 } catch (ArgumentNullException ex) {
2004 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2005 Assert.IsNull (ex.InnerException, "#B3");
2006 Assert.IsNotNull (ex.Message, "#B4");
2007 Assert.IsNotNull (ex.ParamName, "#B5");
2008 Assert.AreEqual ("providedArgs", ex.ParamName, "#B6");
2012 [Test] // bug #336841
2013 [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306797
2014 public void InvokeMember_VarArgs ()
2016 BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.Public |
2017 BindingFlags.NonPublic | BindingFlags.OptionalParamBinding |
2018 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2019 BindingFlags.Instance;
2021 Type type = typeof (TypeTest);
2022 string result = (string) type.InvokeMember ("bug336841",
2023 flags, null, null, new object [] { "1" });
2024 Assert.IsNotNull (result, "#A1");
2025 Assert.AreEqual ("#B:1", result, "#A2");
2027 result = (string) type.InvokeMember ("bug336841", flags,
2028 null, null, new object [] { "1", "2", "3", "4" });
2029 Assert.IsNotNull (result, "#B1");
2030 Assert.AreEqual ("#A:1|2,3,4", result, "#B2");
2034 [Test] // bug #348522
2035 public void InvokeMember_WithoutDefaultValue ()
2037 BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;
2039 typeof (Bug348522).InvokeMember ("Test", flags, new FirstMethodBinder (), new Bug348522(),
2040 new object [] {Missing.Value}, null, null, null);
2042 } catch (ArgumentException ex) {
2043 // Missing parameter does not have a default value
2044 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2045 Assert.IsNull (ex.InnerException, "#3");
2046 Assert.IsNotNull (ex.Message, "#4");
2047 Assert.IsNotNull (ex.ParamName, "#5");
2048 Assert.AreEqual ("parameters", ex.ParamName, "#6");
2053 public void TestMissing () {
2054 Assert.AreEqual (Type.Missing, Missing.Value);
2058 public void GetGenericMethodDefinitionOverInflatedMethodOnGTD () {
2059 var l = typeof (List<>);
2060 var m = l.GetMethod ("ConvertAll");
2061 var infl = m.MakeGenericMethod (typeof (int));
2062 var res = m.GetGenericMethodDefinition ();
2063 Assert.AreEqual (m, res, "#1");
2067 public void InvokeMember_OutParam ()
2069 object[] args = new object[] { new string [0] };
2070 typeof (TypeTest).InvokeMember ("OutTest", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, args);
2071 Assert.IsTrue (args [0] is string[]);
2072 Assert.AreEqual (10, ((string[])args[0]).Length);
2075 public static void OutTest (out string[] a1)
2077 a1 = new string [10];
2082 public static int Value;
2091 public Z (IComparable value)
2096 public static void Run ()
2104 public TakesInt (int x)
2109 public int Integer {
2116 public TakesObject (object x) {}
2119 [Test] // bug #75241
2120 public void GetConstructorNullInTypes ()
2122 // This ends up calling type.GetConstructor ()
2123 Activator.CreateInstance (typeof (TakesInt), new object [] { null });
2124 Activator.CreateInstance (typeof (TakesObject), new object [] { null });
2128 public void GetConstructor_TakeInt_Object ()
2130 Assert.IsNull (typeof (TakesInt).GetConstructor (new Type[1] { typeof (object) }));
2134 public void GetCustomAttributes_All ()
2136 object [] attrs = typeof (A).GetCustomAttributes (false);
2137 Assert.AreEqual (2, attrs.Length, "#A1");
2138 Assert.IsTrue (HasAttribute (attrs, typeof (FooAttribute)), "#A2");
2139 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#A3");
2141 attrs = typeof (BA).GetCustomAttributes (false);
2142 Assert.AreEqual (1, attrs.Length, "#B1");
2143 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#B2");
2145 attrs = typeof (BA).GetCustomAttributes (true);
2146 Assert.AreEqual (2, attrs.Length, "#C1");
2147 Assert.IsTrue (HasAttribute (attrs, typeof (BarAttribute)), "#C2");
2148 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#C3");
2150 attrs = typeof (CA).GetCustomAttributes (false);
2151 Assert.AreEqual (0, attrs.Length, "#D");
2153 attrs = typeof (CA).GetCustomAttributes (true);
2154 Assert.AreEqual (1, attrs.Length, "#E1");
2155 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E2");
2158 static bool HasAttribute (object [] attrs, Type attributeType)
2160 foreach (object attr in attrs)
2161 if (attr.GetType () == attributeType)
2167 public void GetCustomAttributes_Type ()
2169 object [] attrs = null;
2171 attrs = typeof (A).GetCustomAttributes (
2172 typeof (VolatileModifier), false);
2173 Assert.AreEqual (1, attrs.Length, "#A1");
2174 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A2");
2175 attrs = typeof (A).GetCustomAttributes (
2176 typeof (VolatileModifier), true);
2177 Assert.AreEqual (1, attrs.Length, "#A3");
2178 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A4");
2180 attrs = typeof (A).GetCustomAttributes (
2181 typeof (NemerleAttribute), false);
2182 Assert.AreEqual (1, attrs.Length, "#B1");
2183 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B2");
2184 attrs = typeof (A).GetCustomAttributes (
2185 typeof (NemerleAttribute), true);
2186 Assert.AreEqual (1, attrs.Length, "#B3");
2187 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B4");
2189 attrs = typeof (A).GetCustomAttributes (
2190 typeof (FooAttribute), false);
2191 Assert.AreEqual (1, attrs.Length, "#C1");
2192 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C2");
2193 attrs = typeof (A).GetCustomAttributes (
2194 typeof (FooAttribute), false);
2195 Assert.AreEqual (1, attrs.Length, "#C3");
2196 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C4");
2198 attrs = typeof (BA).GetCustomAttributes (
2199 typeof (VolatileModifier), false);
2200 Assert.AreEqual (0, attrs.Length, "#D1");
2201 attrs = typeof (BA).GetCustomAttributes (
2202 typeof (VolatileModifier), true);
2203 Assert.AreEqual (1, attrs.Length, "#D2");
2204 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#D3");
2206 attrs = typeof (BA).GetCustomAttributes (
2207 typeof (NemerleAttribute), false);
2208 Assert.AreEqual (0, attrs.Length, "#E1");
2209 attrs = typeof (BA).GetCustomAttributes (
2210 typeof (NemerleAttribute), true);
2211 Assert.AreEqual (1, attrs.Length, "#E2");
2212 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E3");
2214 attrs = typeof (BA).GetCustomAttributes (
2215 typeof (FooAttribute), false);
2216 Assert.AreEqual (1, attrs.Length, "#F1");
2217 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F2");
2218 attrs = typeof (BA).GetCustomAttributes (
2219 typeof (FooAttribute), true);
2220 Assert.AreEqual (1, attrs.Length, "#F3");
2221 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F4");
2223 attrs = typeof (bug82431A1).GetCustomAttributes (
2224 typeof (InheritAttribute), false);
2225 Assert.AreEqual (1, attrs.Length, "#G1");
2226 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G2");
2227 attrs = typeof (bug82431A1).GetCustomAttributes (
2228 typeof (InheritAttribute), true);
2229 Assert.AreEqual (1, attrs.Length, "#G3");
2230 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G4");
2232 attrs = typeof (bug82431A1).GetCustomAttributes (
2233 typeof (NotInheritAttribute), false);
2234 Assert.AreEqual (1, attrs.Length, "#H1");
2235 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H2");
2236 attrs = typeof (bug82431A1).GetCustomAttributes (
2237 typeof (InheritAttribute), true);
2238 Assert.AreEqual (1, attrs.Length, "#H3");
2239 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H4");
2241 attrs = typeof (bug82431A2).GetCustomAttributes (
2242 typeof (InheritAttribute), false);
2243 Assert.AreEqual (0, attrs.Length, "#I1");
2244 attrs = typeof (bug82431A2).GetCustomAttributes (
2245 typeof (InheritAttribute), true);
2246 Assert.AreEqual (0, attrs.Length, "#I2");
2248 attrs = typeof (bug82431A2).GetCustomAttributes (
2249 typeof (NotInheritAttribute), false);
2250 Assert.AreEqual (0, attrs.Length, "#J1");
2251 attrs = typeof (bug82431A2).GetCustomAttributes (
2252 typeof (NotInheritAttribute), true);
2253 Assert.AreEqual (0, attrs.Length, "#J2");
2255 attrs = typeof (bug82431A3).GetCustomAttributes (
2256 typeof (InheritAttribute), false);
2257 Assert.AreEqual (2, attrs.Length, "#K1");
2258 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K2");
2259 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K3");
2260 attrs = typeof (bug82431A3).GetCustomAttributes (
2261 typeof (InheritAttribute), true);
2262 Assert.AreEqual (2, attrs.Length, "#K4");
2263 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K5");
2264 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K6");
2266 attrs = typeof (bug82431A3).GetCustomAttributes (
2267 typeof (NotInheritAttribute), false);
2268 Assert.AreEqual (1, attrs.Length, "#L1");
2269 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L2");
2270 attrs = typeof (bug82431A3).GetCustomAttributes (
2271 typeof (NotInheritAttribute), true);
2272 Assert.AreEqual (1, attrs.Length, "#L3");
2273 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L4");
2275 attrs = typeof (bug82431B1).GetCustomAttributes (
2276 typeof (InheritAttribute), false);
2277 Assert.AreEqual (1, attrs.Length, "#M1");
2278 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M2");
2279 attrs = typeof (bug82431B1).GetCustomAttributes (
2280 typeof (InheritAttribute), true);
2281 Assert.AreEqual (1, attrs.Length, "#M3");
2282 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M4");
2284 attrs = typeof (bug82431B1).GetCustomAttributes (
2285 typeof (NotInheritAttribute), false);
2286 Assert.AreEqual (0, attrs.Length, "#N1");
2287 attrs = typeof (bug82431B1).GetCustomAttributes (
2288 typeof (NotInheritAttribute), true);
2289 Assert.AreEqual (0, attrs.Length, "#N2");
2291 attrs = typeof (bug82431B2).GetCustomAttributes (
2292 typeof (InheritAttribute), false);
2293 Assert.AreEqual (0, attrs.Length, "#O1");
2294 attrs = typeof (bug82431B2).GetCustomAttributes (
2295 typeof (InheritAttribute), true);
2296 Assert.AreEqual (1, attrs.Length, "#O2");
2297 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#O3");
2299 attrs = typeof (bug82431B2).GetCustomAttributes (
2300 typeof (NotInheritAttribute), false);
2301 Assert.AreEqual (0, attrs.Length, "#P1");
2302 attrs = typeof (bug82431B2).GetCustomAttributes (
2303 typeof (NotInheritAttribute), true);
2304 Assert.AreEqual (0, attrs.Length, "#P2");
2306 attrs = typeof (bug82431B3).GetCustomAttributes (
2307 typeof (InheritAttribute), false);
2308 Assert.AreEqual (1, attrs.Length, "#Q1");
2309 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q2");
2310 attrs = typeof (bug82431B3).GetCustomAttributes (
2311 typeof (InheritAttribute), true);
2312 Assert.AreEqual (2, attrs.Length, "#Q3");
2313 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q4");
2314 Assert.AreEqual (typeof (InheritAttribute), attrs [1].GetType (), "#Q5");
2316 attrs = typeof (bug82431B3).GetCustomAttributes (
2317 typeof (NotInheritAttribute), false);
2318 Assert.AreEqual (1, attrs.Length, "#R1");
2319 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R2");
2320 attrs = typeof (bug82431B3).GetCustomAttributes (
2321 typeof (NotInheritAttribute), true);
2322 Assert.AreEqual (1, attrs.Length, "#R3");
2323 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R4");
2325 attrs = typeof (bug82431B4).GetCustomAttributes (
2326 typeof (InheritAttribute), false);
2327 Assert.AreEqual (0, attrs.Length, "#S1");
2328 attrs = typeof (bug82431B4).GetCustomAttributes (
2329 typeof (InheritAttribute), true);
2330 Assert.AreEqual (1, attrs.Length, "#S2");
2331 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#S3");
2333 attrs = typeof (bug82431B4).GetCustomAttributes (
2334 typeof (NotInheritAttribute), false);
2335 Assert.AreEqual (0, attrs.Length, "#T1");
2336 attrs = typeof (bug82431B4).GetCustomAttributes (
2337 typeof (NotInheritAttribute), true);
2338 Assert.AreEqual (0, attrs.Length, "#T2");
2340 attrs = typeof (A).GetCustomAttributes (
2341 typeof (string), false);
2342 Assert.AreEqual (0, attrs.Length, "#U1");
2343 attrs = typeof (A).GetCustomAttributes (
2344 typeof (string), true);
2345 Assert.AreEqual (0, attrs.Length, "#U2");
2348 [Test] // bug #76150
2349 public void IsDefined ()
2351 Assert.IsTrue (typeof (A).IsDefined (typeof (NemerleAttribute), false), "#A1");
2352 Assert.IsTrue (typeof (A).IsDefined (typeof (VolatileModifier), false), "#A2");
2353 Assert.IsTrue (typeof (A).IsDefined (typeof (FooAttribute), false), "#A3");
2354 Assert.IsFalse (typeof (A).IsDefined (typeof (BarAttribute), false), "#A4");
2356 Assert.IsFalse (typeof (BA).IsDefined (typeof (NemerleAttribute), false), "#B1");
2357 Assert.IsFalse (typeof (BA).IsDefined (typeof (VolatileModifier), false), "#B2");
2358 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), false), "#B3");
2359 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), false), "#B4");
2360 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), false), "#B5");
2361 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), false), "#B6");
2362 Assert.IsTrue (typeof (BA).IsDefined (typeof (NemerleAttribute), true), "#B7");
2363 Assert.IsTrue (typeof (BA).IsDefined (typeof (VolatileModifier), true), "#B8");
2364 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), true), "#B9");
2365 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), true), "#B10");
2366 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), true), "#B11");
2367 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), true), "#B12");
2371 public void IsDefined_AttributeType_Null ()
2374 typeof (BA).IsDefined ((Type) null, false);
2376 } catch (ArgumentNullException ex) {
2377 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2378 Assert.IsNull (ex.InnerException, "#3");
2379 Assert.IsNotNull (ex.Message, "#4");
2380 Assert.IsNotNull (ex.ParamName, "#5");
2381 Assert.AreEqual ("attributeType", ex.ParamName, "#6");
2385 [Test] // bug #82431
2386 [Category ("NotWorking")]
2387 public void IsDefined_Inherited ()
2389 Assert.IsFalse (typeof (CA).IsDefined (typeof (NemerleAttribute), false), "#C1");
2390 Assert.IsFalse (typeof (CA).IsDefined (typeof (VolatileModifier), false), "#C2");
2391 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), false), "#C3");
2392 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), false), "#C4");
2393 Assert.IsTrue (typeof (CA).IsDefined (typeof (NemerleAttribute), true), "#C5");
2394 Assert.IsTrue (typeof (CA).IsDefined (typeof (VolatileModifier), true), "#C6");
2395 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), true), "#C7");
2396 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), true), "#C8");
2398 Assert.IsFalse (typeof (BBA).IsDefined (typeof (NemerleAttribute), false), "#D1");
2399 Assert.IsFalse (typeof (BBA).IsDefined (typeof (VolatileModifier), false), "#D2");
2400 Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), false), "#D3");
2401 Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), false), "#D4");
2402 Assert.IsTrue (typeof (BBA).IsDefined (typeof (NemerleAttribute), true), "#D5");
2403 Assert.IsTrue (typeof (BBA).IsDefined (typeof (VolatileModifier), true), "#D6");
2404 Assert.IsTrue (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2405 Assert.IsTrue (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2407 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), false), "#E1");
2408 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), false), "#E2");
2409 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), true), "#E3");
2410 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), true), "#E4");
2412 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), false), "#F1");
2413 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), false), "#F2");
2414 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2415 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), true), "#F4");
2417 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), false), "#G1");
2418 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), false), "#G2");
2419 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), true), "#G3");
2420 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), true), "#G4");
2422 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), false), "#H1");
2423 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), false), "#H2");
2424 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), true), "#H3");
2425 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), true), "#H4");
2427 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), false), "#I1");
2428 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), false), "#I2");
2429 Assert.IsTrue (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), true), "#I3");
2430 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), true), "#I4");
2432 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), false), "#J1");
2433 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), false), "#J2");
2434 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), true), "#J3");
2435 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), true), "#J4");
2437 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), false), "#K2");
2438 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), false), "#K2");
2439 Assert.IsTrue (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), true), "#K3");
2440 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
2443 [Test] // GetType (String)
2444 public void GetType1_TypeName_Null ()
2447 Type.GetType ((string) null);
2449 } catch (ArgumentNullException ex) {
2450 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2451 Assert.IsNull (ex.InnerException, "#3");
2452 Assert.IsNotNull (ex.Message, "#4");
2453 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2457 [Test] // GetType (String, Boolean)
2458 public void GetType2_TypeName_Null ()
2461 Type.GetType ((string) null, false);
2463 } catch (ArgumentNullException ex) {
2464 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2465 Assert.IsNull (ex.InnerException, "#3");
2466 Assert.IsNotNull (ex.Message, "#4");
2467 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2471 [Test] // GetType (String, Boolean, Boolean)
2472 public void GetType3_TypeName_Null ()
2475 Type.GetType ((string) null, false, false);
2477 } catch (ArgumentNullException ex) {
2478 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2479 Assert.IsNull (ex.InnerException, "#3");
2480 Assert.IsNotNull (ex.Message, "#4");
2481 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2486 public void GetTypeArray_Args_Null ()
2489 Type.GetTypeArray ((object []) null);
2491 } catch (ArgumentNullException ex) {
2492 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2493 Assert.IsNull (ex.InnerException, "#3");
2494 Assert.IsNotNull (ex.Message, "#4");
2495 Assert.AreEqual ("args", ex.ParamName, "#5");
2500 public void GetTypeCode ()
2502 Assert.AreEqual (TypeCode.Boolean, Type.GetTypeCode (typeof (bool)), "#1");
2503 Assert.AreEqual (TypeCode.Byte, Type.GetTypeCode (typeof (byte)), "#2");
2504 Assert.AreEqual (TypeCode.Char, Type.GetTypeCode (typeof (char)), "#3");
2505 Assert.AreEqual (TypeCode.DateTime, Type.GetTypeCode (typeof (DateTime)), "#4");
2506 Assert.AreEqual (TypeCode.DBNull, Type.GetTypeCode (typeof (DBNull)), "#5");
2507 Assert.AreEqual (TypeCode.Decimal, Type.GetTypeCode (typeof (decimal)), "#6");
2508 Assert.AreEqual (TypeCode.Double, Type.GetTypeCode (typeof (double)), "#7");
2509 Assert.AreEqual (TypeCode.Empty, Type.GetTypeCode (null), "#8");
2510 Assert.AreEqual (TypeCode.Int16, Type.GetTypeCode (typeof (short)), "#9");
2511 Assert.AreEqual (TypeCode.Int32, Type.GetTypeCode (typeof (int)), "#10");
2512 Assert.AreEqual (TypeCode.Int64, Type.GetTypeCode (typeof (long)), "#11");
2513 Assert.AreEqual (TypeCode.Object, Type.GetTypeCode (typeof (TakesInt)), "#12");
2514 Assert.AreEqual (TypeCode.SByte, Type.GetTypeCode (typeof (sbyte)), "#13");
2515 Assert.AreEqual (TypeCode.Single, Type.GetTypeCode (typeof (float)), "#14");
2516 Assert.AreEqual (TypeCode.String, Type.GetTypeCode (typeof (string)), "#15");
2517 Assert.AreEqual (TypeCode.UInt16, Type.GetTypeCode (typeof (ushort)), "#16");
2518 Assert.AreEqual (TypeCode.UInt32, Type.GetTypeCode (typeof (uint)), "#17");
2519 Assert.AreEqual (TypeCode.UInt64, Type.GetTypeCode (typeof (ulong)), "#18");
2523 public void GetTypeFromHandle_Handle_Zero ()
2525 RuntimeTypeHandle handle = new RuntimeTypeHandle ();
2527 Assert.IsNull (Type.GetTypeFromHandle (handle));
2531 public void GetTypeHandle_O_Null ()
2534 Type.GetTypeHandle (null);
2536 } catch (ArgumentNullException ex) {
2537 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2538 Assert.IsNull (ex.InnerException, "#3");
2539 Assert.IsNotNull (ex.Message, "#4");
2540 Assert.IsNull (ex.ParamName, "#5");
2544 [Test] // GetConstructor (Type [])
2545 public void GetConstructor1 ()
2548 ConstructorInfo ctor;
2550 type = typeof (CtorsA);
2551 ctor = type.GetConstructor (Type.EmptyTypes);
2552 Assert.IsNotNull (ctor, "#A1");
2553 Assert.AreEqual (0, ctor.GetParameters ().Length, "#A2");
2554 Assert.IsFalse (ctor.IsStatic, "#A3");
2555 Assert.IsTrue (ctor.IsPublic, "#A4");
2556 Assert.AreEqual (".ctor", ctor.Name, "#A5");
2558 type = typeof (CtorsB);
2559 ctor = type.GetConstructor (Type.EmptyTypes);
2560 Assert.IsNotNull (ctor, "#B1");
2561 Assert.AreEqual (0, ctor.GetParameters ().Length, "#B2");
2562 Assert.IsFalse (ctor.IsStatic, "#B3");
2563 Assert.IsTrue (ctor.IsPublic, "#B4");
2564 Assert.AreEqual (".ctor", ctor.Name, "#B5");
2566 type = typeof (CtorsC);
2567 ctor = type.GetConstructor (Type.EmptyTypes);
2568 Assert.IsNull (ctor, "#C");
2570 type = typeof (CtorsC);
2571 ctor = type.GetConstructor (new Type [] { typeof (int) });
2572 Assert.IsNotNull (ctor, "#D1");
2573 Assert.AreEqual (1, ctor.GetParameters ().Length, "#D2");
2574 Assert.IsFalse (ctor.IsStatic, "#D3");
2575 Assert.IsTrue (ctor.IsPublic, "#D4");
2576 Assert.AreEqual (".ctor", ctor.Name, "#D5");
2579 [Test] // GetConstructor (Type [])
2580 public void GetConstructor1_Types_Null ()
2583 typeof (BindingFlags).GetConstructor (null);
2585 } catch (ArgumentNullException ex) {
2586 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2587 Assert.IsNull (ex.InnerException, "#3");
2588 Assert.IsNotNull (ex.Message, "#4");
2589 Assert.IsNotNull (ex.ParamName, "#5");
2590 Assert.AreEqual ("types", ex.ParamName, "#6");
2594 [Test] // GetConstructor (Type [])
2595 public void GetConstructor1_Types_ItemNull ()
2597 Type type = typeof (BindingFlags);
2599 type.GetConstructor (new Type[1] { null });
2600 Assert.Fail ("#A1");
2601 } catch (ArgumentNullException ex) {
2602 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
2603 Assert.IsNull (ex.InnerException, "#A3");
2604 Assert.IsNotNull (ex.Message, "#A4");
2605 Assert.IsNotNull (ex.ParamName, "#A5");
2606 Assert.AreEqual ("types", ex.ParamName, "#A6");
2609 type = typeof (TakesInt);
2611 type.GetConstructor (new Type [1] { null });
2612 Assert.Fail ("#B1");
2613 } catch (ArgumentNullException ex) {
2614 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2615 Assert.IsNull (ex.InnerException, "#B3");
2616 Assert.IsNotNull (ex.Message, "#B4");
2617 Assert.IsNotNull (ex.ParamName, "#B5");
2618 Assert.AreEqual ("types", ex.ParamName, "#B6");
2622 [Test] // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier [])
2623 public void GetConstructor2_Types_ItemNull ()
2625 Type type = typeof (BindingFlags);
2627 type.GetConstructor (BindingFlags.Default, null,
2628 new Type[1] { null }, null);
2630 } catch (ArgumentNullException ex) {
2631 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2632 Assert.IsNull (ex.InnerException, "#3");
2633 Assert.IsNotNull (ex.Message, "#4");
2634 Assert.IsNotNull (ex.ParamName, "#5");
2635 Assert.AreEqual ("types", ex.ParamName, "#6");
2639 [Test] // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier [])
2640 public void GetConstructor3_Types_ItemNull ()
2642 Type type = typeof (BindingFlags);
2644 type.GetConstructor (BindingFlags.Default,
2645 null, CallingConventions.Any,
2646 new Type[1] { null }, null);
2648 } catch (ArgumentNullException ex) {
2649 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2650 Assert.IsNull (ex.InnerException, "#3");
2651 Assert.IsNotNull (ex.Message, "#4");
2652 Assert.IsNotNull (ex.ParamName, "#5");
2653 Assert.AreEqual ("types", ex.ParamName, "#6");
2658 public void GetMethod_Bug77367 ()
2660 MethodInfo i = typeof (Bug77367).GetMethod ("Run", Type.EmptyTypes);
2664 #if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM
2666 public void EqualsUnderlyingType ()
2668 AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
2669 TypeAttributes attribs = TypeAttributes.Public;
2671 AssemblyName name = new AssemblyName ();
2672 name.Name = "enumtest";
2673 AssemblyBuilder assembly =
2674 AppDomain.CurrentDomain.DefineDynamicAssembly (
2677 ModuleBuilder module = assembly.DefineDynamicModule
2678 ("m", "enumtest.dll");
2679 EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
2681 Assert.IsTrue (typeof (int).Equals (e));
2683 #endif // TARGET_JVM
2686 public void Equals_Type_Null ()
2688 Assert.IsFalse (typeof (int).Equals ((Type) null), "#1");
2689 Assert.IsFalse (typeof (int).Equals ((object) null), "#2");
2693 public void GetElementType_Bug63841 ()
2695 Assert.IsNull (typeof (TheEnum).GetElementType (), "#1");
2699 public void FullNameGenerics ()
2701 Type fooType = typeof (Foo<>);
2702 FieldInfo [] fields = fooType.GetFields ();
2704 Assert.AreEqual (1, fields.Length, "#0");
2706 Assert.IsNotNull (fooType.FullName, "#1");
2707 Assert.IsNotNull (fooType.AssemblyQualifiedName, "#1a");
2709 FieldInfo field = fooType.GetField ("Whatever");
2710 Assert.IsNotNull (field, "#2");
2711 Assert.AreEqual (field, fields [0], "#2a");
2712 Assert.IsNull (field.FieldType.FullName, "#3");
2713 Assert.IsNull (field.FieldType.AssemblyQualifiedName, "#3a");
2714 Assert.IsNotNull (field.FieldType.ToString (), "#4");
2716 PropertyInfo prop = fooType.GetProperty ("Test");
2717 Assert.IsNotNull (prop, "#5");
2718 Assert.IsNull (prop.PropertyType.FullName, "#6");
2719 Assert.IsNull (prop.PropertyType.AssemblyQualifiedName, "#6a");
2720 Assert.IsNotNull (prop.PropertyType.ToString (), "#7");
2722 MethodInfo method = fooType.GetMethod("Execute");
2723 Assert.IsNotNull (method, "#8");
2724 Assert.IsNull (method.ReturnType.FullName, "#9");
2725 Assert.IsNull (method.ReturnType.AssemblyQualifiedName, "#9a");
2726 Assert.IsNotNull (method.ReturnType.ToString (), "#10");
2728 ParameterInfo[] parameters = method.GetParameters();
2729 Assert.AreEqual (1, parameters.Length, "#11");
2730 Assert.IsNull (parameters[0].ParameterType.FullName, "#12");
2731 Assert.IsNull (parameters[0].ParameterType.AssemblyQualifiedName, "#12a");
2732 Assert.IsNotNull (parameters[0].ParameterType.ToString (), "#13");
2736 public void TypeParameterIsNotGeneric ()
2738 Type fooType = typeof (Foo<>);
2739 Type type_param = fooType.GetGenericArguments () [0];
2740 Assert.IsTrue (type_param.IsGenericParameter);
2741 Assert.IsFalse (type_param.IsGenericType);
2742 Assert.IsFalse (type_param.IsGenericTypeDefinition);
2744 // LAMESPEC: MSDN claims that this should be false, but .NET v2.0.50727 says it's true
2745 // http://msdn2.microsoft.com/en-us/library/system.type.isgenerictype.aspx
2746 Assert.IsTrue (type_param.ContainsGenericParameters);
2750 public void IsAssignable ()
2752 Type foo_type = typeof (Foo<>);
2753 Type foo_int_type = typeof (Foo<int>);
2754 Assert.IsFalse (foo_type.IsAssignableFrom (foo_int_type), "Foo<int> -!-> Foo<>");
2755 Assert.IsFalse (foo_int_type.IsAssignableFrom (foo_type), "Foo<> -!-> Foo<int>");
2757 Type ibar_short_type = typeof (IBar<short>);
2758 Type ibar_int_type = typeof (IBar<int>);
2759 Type baz_short_type = typeof (Baz<short>);
2760 Type baz_int_type = typeof (Baz<int>);
2762 Assert.IsTrue (ibar_int_type.IsAssignableFrom (baz_int_type), "Baz<int> -> IBar<int>");
2763 Assert.IsTrue (ibar_short_type.IsAssignableFrom (baz_short_type), "Baz<short> -> IBar<short>");
2765 Assert.IsFalse (ibar_int_type.IsAssignableFrom (baz_short_type), "Baz<short> -!-> IBar<int>");
2766 Assert.IsFalse (ibar_short_type.IsAssignableFrom (baz_int_type), "Baz<int> -!-> IBar<short>");
2769 Assert.IsTrue (typeof (Nullable<int>).IsAssignableFrom (typeof (int)));
2770 Assert.IsFalse (typeof (int).IsAssignableFrom (typeof (Nullable<int>)));
2771 Assert.IsTrue (typeof (Nullable<FooStruct>).IsAssignableFrom (typeof (FooStruct)));
2775 public void IsInstanceOf ()
2777 Assert.IsTrue (typeof (Nullable<int>).IsInstanceOfType (5));
2781 public void IsInstanceOfArrayOfNullable ()
2783 Assert.IsTrue (typeof (Nullable<int>[]).IsInstanceOfType (new Nullable<int> [0]));
2787 public void IsInstanceOfType_Null ()
2789 Assert.IsFalse (typeof (int).IsInstanceOfType (null), "int");
2790 Assert.IsFalse (typeof (object).IsInstanceOfType (null), "object");
2791 Assert.IsFalse (typeof (int?).IsInstanceOfType (null), "int?");
2795 public void ByrefType ()
2797 Type foo_type = typeof (Foo<>);
2798 Type type_param = foo_type.GetGenericArguments () [0];
2799 Type byref_type_param = type_param.MakeByRefType ();
2800 Assert.IsFalse (byref_type_param.IsGenericParameter);
2801 Assert.IsNull (byref_type_param.DeclaringType);
2805 [ExpectedException (typeof (TypeLoadException))]
2806 public void MakeByRefByRef ()
2808 typeof (int).MakeByRefType ().MakeByRefType ();
2812 public void MakeArrayTypeTest ()
2814 // This should not crash:
2815 typeof (void).MakeArrayType ();
2820 public class ComFoo<T> {
2824 public void GetCustomAttributesGenericInstance ()
2826 Assert.AreEqual (1, typeof (ComFoo<int>).GetCustomAttributes (typeof (ComVisibleAttribute), true).Length);
2829 interface ByRef1<T> { void f (ref T t); }
2830 interface ByRef2 { void f<T> (ref T t); }
2832 interface ByRef3<T> where T:struct { void f (ref T? t); }
2833 interface ByRef4 { void f<T> (ref T? t) where T:struct; }
2835 void CheckGenericByRef (Type t)
2837 string name = t.Name;
2838 t = t.GetMethod ("f").GetParameters () [0].ParameterType;
2840 Assert.IsFalse (t.IsGenericType, name);
2841 Assert.IsFalse (t.IsGenericTypeDefinition, name);
2842 Assert.IsFalse (t.IsGenericParameter, name);
2846 public void GenericByRef ()
2848 CheckGenericByRef (typeof (ByRef1<>));
2849 CheckGenericByRef (typeof (ByRef2));
2850 CheckGenericByRef (typeof (ByRef3<>));
2851 CheckGenericByRef (typeof (ByRef4));
2854 public class Bug80242<T> {
2855 public interface IFoo { }
2856 public class Bar : IFoo { }
2857 public class Baz : Bar { }
2861 public void TestNestedTypes ()
2863 Type t = typeof (Bug80242<object>);
2864 Assert.IsFalse (t.IsGenericTypeDefinition);
2865 foreach (Type u in t.GetNestedTypes ()) {
2866 Assert.IsTrue (u.IsGenericTypeDefinition, "{0} isn't a generic definition", u);
2867 Assert.AreEqual (u, u.GetGenericArguments () [0].DeclaringType);
2871 [Test] // bug #82211
2872 public void GetMembers_GenericArgument ()
2874 Type argType = typeof (ComFoo<>).GetGenericArguments () [0];
2875 MemberInfo [] members = argType.GetMembers ();
2876 Assert.IsNotNull (members, "#1");
2877 Assert.AreEqual (4, members.Length, "#2");
2881 [ExpectedException (typeof (ArgumentNullException))]
2882 public void ReflectionOnlyGetTypeNullTypeName ()
2884 Type.ReflectionOnlyGetType (null, false, false);
2888 public void ReflectionOnlyGetTypeDoNotThrow ()
2890 Assert.IsNull (Type.ReflectionOnlyGetType ("a, nonexistent.dll", false, false));
2894 [ExpectedException (typeof (FileNotFoundException))]
2895 public void ReflectionOnlyGetTypeThrow ()
2897 Type.ReflectionOnlyGetType ("a, nonexistent.dll", true, false);
2901 public void ReflectionOnlyGetType ()
2903 Type t = Type.ReflectionOnlyGetType (typeof (int).AssemblyQualifiedName.ToString (), true, true);
2904 Assert.AreEqual ("System.Int32", t.FullName);
2907 [Test] //bug #331199
2908 public void MakeGenericType_UserDefinedType ()
2910 Type ut = new UserType (typeof (int));
2911 Type t = typeof (Foo<>).MakeGenericType (ut);
2912 Assert.IsTrue (t.IsGenericType, "#A1");
2913 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2915 Type arg = t.GetGenericArguments () [0];
2916 Assert.IsNotNull (arg, "#B1");
2917 Assert.IsFalse (arg.IsGenericType, "#B2");
2918 Assert.AreEqual (ut, arg, "#B3");
2921 [Category ("NotWorking")]
2922 //We dont support instantiating a user type
2923 public void MakeGenericType_NestedUserDefinedType ()
2925 Type ut = new UserType (new UserType (typeof (int)));
2926 Type t = typeof (Foo<>).MakeGenericType (ut);
2927 Assert.IsTrue (t.IsGenericType, "#A1");
2928 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2930 Type arg = t.GetGenericArguments () [0];
2931 Assert.IsNotNull (arg, "#B1");
2932 Assert.IsFalse (arg.IsGenericType, "#B2");
2933 Assert.AreEqual (ut, arg, "#B3");
2937 [Category ("NotWorking")]
2938 public void TestMakeGenericType_UserDefinedType_DotNet20SP1 ()
2940 Type ut = new UserType(typeof(int));
2941 Type t = typeof(Foo<>).MakeGenericType(ut);
2942 Assert.IsTrue (t.IsGenericType, "#1");
2944 Assert.AreEqual (ut, t.GetGenericArguments()[0], "#2");
2948 public void MakeGenericType_BadUserType ()
2950 Type ut = new UserType (null);
2952 Type t = typeof (Foo<>).MakeGenericType (ut);
2954 } catch (ArgumentException) {
2959 public void MakeGenericType_WrongNumOfArguments ()
2962 Type t = typeof (Foo<,>).MakeGenericType (new Type [] { typeof (int) });
2964 } catch (ArgumentException) {
2968 [AttributeUsage (AttributeTargets.All)]
2969 public class DocAttribute : Attribute {
2970 public DocAttribute (string docs) {}
2973 class GenericClassWithAttributes<[Doc ("T")] T, [Doc ("B")] B>
2974 where T : class, new ()
2977 public T Bar { get{return null;}}
2979 public void M<[Doc ("X")] X> (X x)
2984 [Test] //bug #377596
2985 public void GetGenericArguments_ArgumentsHaveAttributes ()
2987 Type type = typeof(GenericClassWithAttributes<,>);
2988 Type[] tArgs = type.GetGenericArguments ();
2989 MethodInfo m = type.GetMethod ("M");
2990 Type[] mArgs = m.GetGenericArguments ();
2991 Assert.AreEqual(1, tArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2992 Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2993 Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2996 [Test] //bug #471255
2997 public void GetTypeCalledUsingReflection ()
2999 Type expectedType = Type.GetType ("NoNamespaceClass");
3000 Assert.IsNotNull (expectedType, "#1");
3001 MethodInfo m = typeof (Type).GetMethod ("GetType", BindingFlags.Public | BindingFlags.Static, null, new Type [] { typeof (string) }, null);
3002 object r = m.Invoke (null, BindingFlags.Default, null, new object [] { "NoNamespaceClass" }, CultureInfo.InvariantCulture);
3003 Assert.AreSame (expectedType, r, "#2");
3007 public void EqualsUserType () {
3008 UserType2 t1 = new UserType2(null);
3009 UserType2 t2 = new UserType2(t1);
3010 Assert.IsTrue (t1.Equals(t2));
3014 public void GetHashCodeUserType () {
3015 UserType2 t1 = new UserType2(null);
3016 UserType2 t2 = new UserType2(t1);
3017 Assert.AreEqual (42, t2.GetHashCode());
3021 public void IsGenericTypeDefinitionUserType () {
3022 Assert.IsFalse (new UserType(null).IsGenericTypeDefinition);
3026 public void IsGenericTypeUserType () {
3027 Assert.IsFalse (new UserType(null).IsGenericType);
3031 [ExpectedException (typeof (NotSupportedException))]
3032 public void GetGenericTypeDefinitionUserType () {
3033 new UserType(null).GetGenericTypeDefinition ();
3036 [ExpectedException (typeof (NotSupportedException))]
3037 public void GetGenericArgumentsUserType () {
3038 new UserType(null).GetGenericArguments ();
3042 [ExpectedException (typeof (InvalidOperationException))]
3043 public void GenericParameterPositionUserType () {
3044 Assert.IsTrue (new UserType(null).GenericParameterPosition == 0);
3048 public void TypeGetMemberReturnTypeTest ()
3051 MemberTypes memtype;
3053 object [] flagsandtypes = new object [] {
3054 MemberTypes.All, typeof (MemberInfo []),
3055 MemberTypes.Constructor, typeof (ConstructorInfo []),
3056 MemberTypes.Custom, typeof (MemberInfo []),
3057 MemberTypes.Event, typeof (EventInfo []),
3058 MemberTypes.Field, typeof (FieldInfo []),
3059 MemberTypes.Method, typeof (MethodInfo []),
3060 MemberTypes.NestedType, typeof (Type []),
3061 MemberTypes.Property, typeof (PropertyInfo []),
3062 MemberTypes.TypeInfo, typeof (Type [])};
3064 for (int i=0; i < flagsandtypes.Length; i+=2) {
3065 memtype = (MemberTypes)flagsandtypes [i];
3066 testtype = (Type)flagsandtypes [i+1];
3067 obj = GetType ().GetMember ("DummyMember", memtype,
3068 BindingFlags.Public | BindingFlags.Instance);
3069 Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
3070 "Expected " + testtype.FullName);
3076 public void TypeNameStartsWithSpace ()
3078 Type t1 = Type.GetType ("System.Type, mscorlib");
3079 Type t2 = Type.GetType (" System.Type, mscorlib");
3080 Assert.AreEqual (t1, t2);
3085 public void Bug506757 ()
3087 AssemblyName assemblyName = new AssemblyName ();
3088 assemblyName.Name = "customMod";
3089 assemblyName.Version = new Version (1, 2, 3, 4);
3091 AssemblyBuilder assembly
3092 = Thread.GetDomain().DefineDynamicAssembly(
3093 assemblyName, AssemblyBuilderAccess.RunAndSave);
3095 ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
3097 TypeBuilder type0 = module.DefineType ("Base", TypeAttributes.Public, typeof (object));
3098 TypeBuilder type1 = module.DefineType ("Middle", TypeAttributes.Public, type0);
3099 TypeBuilder type2 = module.DefineType ("End", TypeAttributes.Public, type1);
3101 MethodAttributes attrs0 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3102 MethodAttributes.NewSlot | MethodAttributes.FamORAssem;
3104 MethodAttributes attrs1 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3105 MethodAttributes.FamORAssem;
3107 MethodAttributes attrs2 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3108 MethodAttributes.Public;
3111 MethodBuilder m0 = type0.DefineMethod ("Tst", attrs0, typeof (void), null);
3112 m0.GetILGenerator ().Emit (OpCodes.Ret);
3114 MethodBuilder m1 = type1.DefineMethod ("Tst", attrs1, typeof (void), null);
3115 m1.GetILGenerator ().Emit (OpCodes.Ret);
3117 MethodBuilder m2 = type2.DefineMethod ("Tst", attrs2, typeof (void), null);
3118 m2.GetILGenerator ().Emit (OpCodes.Ret);
3121 type0.CreateType ();
3122 type1.CreateType ();
3123 Type t2 = type2.CreateType ();
3125 foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
3126 Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
3130 public void MakeArrayTypeOfOneDimension ()
3132 Type vector = typeof (int).MakeArrayType ();
3133 Type szarray = typeof (int).MakeArrayType (1);
3135 Assert.AreNotEqual (vector, szarray, "#1");
3136 Assert.AreEqual ("Int32[]", vector.Name, "#2");
3137 Assert.AreEqual ("Int32[*]", szarray.Name, "#3");
3140 public class DeclaringMethodFoo {
3141 public void Test<T> (T t) {}
3142 public void Test2<T> (ref T t) {}
3145 public class DeclaringMethodBar<T> {
3146 public void Test2 (ref T t) {}
3150 public void DeclaringMethodOnlyWorksWithGenericArgs ()
3152 MethodInfo testMethod = typeof (DeclaringMethodFoo).GetMethod ("Test");
3153 MethodBase otherMethod = testMethod.GetParameters ()[0].ParameterType.DeclaringMethod;
3155 Assert.AreEqual (testMethod, otherMethod,"#1");
3157 Assert.IsNull (typeof (DeclaringMethodBar<>).GetGenericArguments ()[0].DeclaringMethod, "#2");
3160 var x = typeof (int).DeclaringMethod;
3162 } catch (InvalidOperationException) {}
3165 var x = typeof (DeclaringMethodFoo).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3167 } catch (InvalidOperationException) {}
3170 var x = typeof (DeclaringMethodBar<>).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3172 } catch (InvalidOperationException) {}
3177 public void GetArrayRankThrowsForNonArrayType ()
3179 Assert.AreEqual (1, typeof (int[]).GetArrayRank (), "#1");
3180 Assert.AreEqual (2, typeof (int[,]).GetArrayRank (), "#2");
3182 typeof (int).GetArrayRank ();
3184 } catch (ArgumentException) {}
3187 [Test] //Bug #564379
3188 public void GetMethodsReturnPublicMethodsInInterfaces ()
3190 Type t = typeof (NonClosingStream);
3191 MethodInfo[] methods = t.GetMethods (BindingFlags.Public | BindingFlags.Instance);
3193 Assert.AreEqual (5, methods.Length, "#1");
3196 foreach (var m in methods) {
3197 if (m.Name.Equals ("ToString"))
3198 Assert.IsTrue (m.DeclaringType == typeof (NonClosingStream), "#" + id);
3199 else if (m.Name.Equals ("Dispose") && m.GetParameters ().Length == 0)
3200 Assert.IsTrue (m.DeclaringType == typeof (Stream), "#" + id);
3201 else if (m.Name.Equals ("Equals") || m.Name.Equals ("GetHashCode") || m.Name.Equals ("GetType"))
3202 Assert.IsTrue (m.DeclaringType == typeof (object), "#" + id);
3204 Assert.Fail ("invalid method " + m);
3210 interface IGetInterfaceMap<in T>
3215 class GetInterfaceMap : IGetInterfaceMap<object>
3217 public string Bar (object t)
3219 return t.GetType ().FullName;
3224 public void GetInterfaceMapWorksWithVariantIfaces ()
3226 InterfaceMapping res = typeof (GetInterfaceMap).GetInterfaceMap (typeof (IGetInterfaceMap <object>));
3227 Assert.AreEqual (typeof (IGetInterfaceMap <object>), res.InterfaceType);
3228 Assert.AreEqual (typeof (object), res.InterfaceMethods [0].GetParameters () [0].ParameterType);
3230 res = typeof (GetInterfaceMap).GetInterfaceMap (typeof (IGetInterfaceMap <string>));
3231 Assert.AreEqual (typeof (IGetInterfaceMap <string>), res.InterfaceType);
3232 Assert.AreEqual (typeof (string), res.InterfaceMethods [0].GetParameters () [0].ParameterType);
3236 public abstract class Stream : IDisposable
3238 public void Dispose ()
3240 Console.WriteLine ("stream::dispose");
3243 protected virtual void Dispose (bool disposing)
3248 public class NonClosingStream
3249 : Stream, IDisposable
3251 void IDisposable.Dispose()
3253 Console.WriteLine ("ncs::dispose");
3256 public override string ToString () { return ""; }
3259 static bool ContainsProperty (PropertyInfo [] props, string name)
3261 foreach (PropertyInfo p in props)
3267 public class NemerleAttribute : Attribute
3271 public class VolatileModifier : NemerleAttribute
3281 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3282 public class FooAttribute : Attribute
3286 public class BarAttribute : FooAttribute
3303 [AttributeUsage (AttributeTargets.Class, Inherited=true)]
3304 public class InheritAttribute : Attribute
3308 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3309 public class NotInheritAttribute : InheritAttribute
3313 [NotInheritAttribute]
3314 public class bug82431A1
3318 public class bug82431A2 : bug82431A1
3322 [NotInheritAttribute]
3324 public class bug82431A3 : bug82431A1
3329 public class bug82431B1
3333 public class bug82431B2 : bug82431B1
3337 [NotInheritAttribute]
3338 public class bug82431B3 : bug82431B2
3342 public class bug82431B4 : bug82431B3
3350 public class Bug77367
3352 public void Run (bool b)
3359 private string PrivInstBlue
3361 get { return null; }
3364 protected string ProtInstBlue
3366 get { return null; }
3369 protected internal string ProIntInstBlue
3371 get { return null; }
3374 public long PubInstBlue
3378 if (PrivInstBlue == null)
3380 return long.MaxValue;
3384 internal int IntInstBlue
3389 private static string PrivStatBlue
3391 get { return null; }
3394 protected static string ProtStatBlue
3396 get { return null; }
3399 protected static internal string ProIntStatBlue
3401 get { return null; }
3404 public static long PubStatBlue
3408 if (PrivStatBlue == null)
3410 return long.MaxValue;
3414 internal static int IntStatBlue
3420 public class Foo : Blue
3422 private string PrivInstBase
3424 get { return null; }
3427 protected string ProtInstBase
3429 get { return null; }
3432 protected internal string ProIntInstBase
3434 get { return null; }
3437 public long PubInstBase
3441 if (PrivInstBase == null)
3443 return long.MaxValue;
3447 internal int IntInstBase
3452 private static string PrivStatBase
3454 get { return null; }
3457 protected static string ProtStatBase
3459 get { return null; }
3462 protected static internal string ProIntStatBase
3464 get { return null; }
3467 public static long PubStatBase
3471 if (PrivStatBase == null)
3473 return long.MaxValue;
3477 internal static int IntStatBase
3483 public class Bar : Foo
3485 private string PrivInst
3487 get { return null; }
3490 protected string ProtInst
3492 get { return null; }
3495 protected internal string ProIntInst
3497 get { return null; }
3504 if (PrivInst == null)
3506 return long.MaxValue;
3510 internal int IntInst
3515 private static string PrivStat
3517 get { return null; }
3520 protected static string ProtStat
3522 get { return null; }
3525 protected static internal string ProIntStat
3527 get { return null; }
3530 public static long PubStat
3534 if (PrivStat == null)
3536 return long.MaxValue;
3540 internal static int IntStat
3566 public CtorsC (int x)
3572 class UserType : Type
3574 protected Type type;
3576 public UserType(Type type) {
3580 public override Type UnderlyingSystemType { get { return this.type; } }
3582 public override Assembly Assembly { get { return this.type == null ? null : this.type.Assembly; } }
3584 public override string AssemblyQualifiedName { get { return null; } }
3586 public override Type BaseType { get { return null; } }
3588 public override Module Module { get { return this.type.Module; } }
3590 public override string Namespace { get { return null; } }
3592 public override bool IsGenericParameter { get { return true; } }
3594 public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
3596 public override bool ContainsGenericParameters { get { return true; } }
3598 public override string FullName { get { return this.type.Name; } }
3600 public override Guid GUID { get { throw new NotSupportedException(); } }
3603 protected override bool IsArrayImpl() {
3607 protected override bool IsByRefImpl()
3612 protected override bool IsCOMObjectImpl()
3617 protected override bool IsPointerImpl()
3622 protected override bool IsPrimitiveImpl()
3628 protected override TypeAttributes GetAttributeFlagsImpl()
3633 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
3634 CallingConventions callConvention, Type[] types,
3635 ParameterModifier[] modifiers)
3640 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
3645 public override Type GetElementType()
3650 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
3656 public override FieldInfo GetField(string name, BindingFlags bindingAttr)
3662 public override Type GetInterface(string name, bool ignoreCase)
3667 public override Type[] GetInterfaces()
3672 public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
3677 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
3682 public override object[] GetCustomAttributes(bool inherit)
3687 public override bool IsDefined(Type attributeType, bool inherit)
3692 public override string Name { get { return this.type.Name; } }
3694 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
3696 throw new NotImplementedException();
3699 public override FieldInfo[] GetFields(BindingFlags bindingAttr)
3701 throw new NotImplementedException();
3704 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
3705 CallingConventions callConvention, Type[] types,
3706 ParameterModifier[] modifiers)
3711 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
3716 public override Type GetNestedType(string name, BindingFlags bindingAttr)
3721 public override Type[] GetNestedTypes(BindingFlags bindingAttr)
3726 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
3731 protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder,
3732 Type returnType, Type[] types, ParameterModifier[] modifiers)
3737 protected override bool HasElementTypeImpl()
3742 public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target,
3743 object[] args, ParameterModifier[] modifiers, CultureInfo culture,
3744 string[] namedParameters)
3746 throw new NotSupportedException();
3750 class UserType2 : UserType {
3751 public UserType2 (Type type) : base (type) {
3754 public override Type UnderlyingSystemType { get { return this.type ?? this; } }
3756 public override int GetHashCode()
3760 return type.GetHashCode();