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);
1740 public int property {
1743 public ByRef0 (int i) {}
1744 public void f (int i) {}
1748 public void ByrefTypes ()
1750 Type t = Type.GetType ("MonoTests.System.TypeTest+ByRef0&");
1751 Assert.IsNotNull (t);
1752 Assert.IsTrue (t.IsByRef);
1753 Assert.AreEqual (0, t.GetMethods (BindingFlags.Public | BindingFlags.Instance).Length);
1754 Assert.AreEqual (0, t.GetConstructors (BindingFlags.Public | BindingFlags.Instance).Length);
1755 Assert.AreEqual (0, t.GetEvents (BindingFlags.Public | BindingFlags.Instance).Length);
1756 Assert.AreEqual (0, t.GetProperties (BindingFlags.Public | BindingFlags.Instance).Length);
1758 Assert.IsNull (t.GetMethod ("f"));
1759 Assert.IsNull (t.GetField ("field"));
1760 Assert.IsNull (t.GetProperty ("property"));
1764 public void TestAssemblyQualifiedName ()
1766 Type t = Type.GetType ("System.Byte[]&");
1767 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte[]&"));
1769 t = Type.GetType ("System.Byte*&");
1770 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte*&"));
1772 t = Type.GetType ("System.Byte&");
1773 Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte&"));
1782 public void CreateValueTypeNoCtor ()
1784 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, null);
1788 [ExpectedException (typeof (MissingMethodException))]
1789 public void CreateValueTypeNoCtorArgs ()
1791 typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, new object [] { 1 });
1794 internal static string bug336841 (string param1, params string [] param2)
1796 StringBuilder sb = new StringBuilder ();
1800 for (int i = 0; i < param2.Length; i++) {
1803 sb.Append (param2 [i]);
1805 return sb.ToString ();
1808 internal static string bug336841 (string param1)
1810 return "#B:" + param1;
1813 internal static string bug336841 (params string [] param1)
1815 StringBuilder sb = new StringBuilder ();
1817 for (int i = 0; i < param1.Length; i++) {
1820 sb.Append (param1 [i]);
1822 return sb.ToString ();
1826 public void InvokeMember_GetSetField ()
1828 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1829 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1830 BindingFlags.SetField, null, null, new object [] { 5 });
1832 Assert.AreEqual (5, X.Value, "#A1");
1833 Assert.AreEqual (5, typeof (X).InvokeMember ("Value",
1834 BindingFlags.Public | BindingFlags.Static |
1835 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1836 null, null, new object [0]), "#A2");
1837 Assert.AreEqual (5, Y.Value, "#A3");
1838 Assert.AreEqual (5, typeof (Y).InvokeMember ("Value",
1839 BindingFlags.Public | BindingFlags.Static |
1840 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1841 null, null, new object [0]), "#A4");
1844 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1845 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1846 BindingFlags.GetField | BindingFlags.SetField,
1847 null, null, new object [] { 5 });
1848 Assert.Fail ("#B1");
1849 } catch (ArgumentException ex) {
1850 // Cannot specify both Get and Set on a field
1851 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1852 Assert.IsNull (ex.InnerException, "#B3");
1853 Assert.IsNotNull (ex.Message, "#B4");
1854 Assert.IsNotNull (ex.ParamName, "#B5");
1855 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1860 public void InvokeMember_GetSetProperty ()
1863 typeof (ArrayList).InvokeMember ("Item",
1864 BindingFlags.GetProperty | BindingFlags.SetProperty |
1865 BindingFlags.Instance | BindingFlags.Public,
1866 null, new ArrayList (), new object [] { 0, "bar" });
1868 } catch (ArgumentException ex) {
1869 // Cannot specify both Get and Set on a property
1870 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1871 Assert.IsNull (ex.InnerException, "#3");
1872 Assert.IsNotNull (ex.Message, "#4");
1873 Assert.IsNotNull (ex.ParamName, "#5");
1874 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1880 public void InvokeMember_InvokeMethod_Set ()
1883 typeof (ArrayList).InvokeMember ("ToString",
1884 BindingFlags.InvokeMethod | BindingFlags.SetField |
1885 BindingFlags.Instance | BindingFlags.Public,
1886 null, new ArrayList (), new object [0]);
1887 Assert.Fail ("#A1");
1888 } catch (ArgumentException ex) {
1889 // Cannot specify Set on a field and Invoke on a method
1890 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1891 Assert.IsNull (ex.InnerException, "#A3");
1892 Assert.IsNotNull (ex.Message, "#A4");
1893 Assert.IsNotNull (ex.ParamName, "#A5");
1894 Assert.AreEqual ("bindingFlags", ex.ParamName, "#A6");
1898 typeof (ArrayList).InvokeMember ("ToString",
1899 BindingFlags.InvokeMethod | BindingFlags.SetProperty |
1900 BindingFlags.Instance | BindingFlags.Public,
1901 null, new ArrayList (), new object [0]);
1902 Assert.Fail ("#B1");
1903 } catch (ArgumentException ex) {
1904 // Cannot specify Set on a property and Invoke on a method
1905 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1906 Assert.IsNull (ex.InnerException, "#B3");
1907 Assert.IsNotNull (ex.Message, "#B4");
1908 Assert.IsNotNull (ex.ParamName, "#B5");
1909 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1914 public void InvokeMember_MatchPrimitiveTypeWithInterface ()
1916 object [] invokeargs = { 1 };
1917 typeof (Z).InvokeMember ("", BindingFlags.DeclaredOnly |
1918 BindingFlags.Public | BindingFlags.NonPublic |
1919 BindingFlags.Instance | BindingFlags.CreateInstance,
1920 null, null, invokeargs);
1924 public void InvokeMember_Name_Null ()
1927 typeof (X).InvokeMember ((string) null,
1928 BindingFlags.Public | BindingFlags.Static |
1929 BindingFlags.FlattenHierarchy | BindingFlags.SetField,
1930 null, null, new object [] { 5 });
1932 } catch (ArgumentNullException ex) {
1933 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1934 Assert.IsNull (ex.InnerException, "#3");
1935 Assert.IsNotNull (ex.Message, "#4");
1936 Assert.IsNotNull (ex.ParamName, "#5");
1937 Assert.AreEqual ("name", ex.ParamName, "#6");
1942 public void InvokeMember_NoOperation ()
1945 typeof (TypeTest).InvokeMember ("Run", BindingFlags.Public |
1946 BindingFlags.Static, null, null, new object [0]);
1948 } catch (ArgumentException ex) {
1949 // Must specify binding flags describing the
1950 // invoke operation required
1951 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1952 Assert.IsNull (ex.InnerException, "#3");
1953 Assert.IsNotNull (ex.Message, "#4");
1954 Assert.IsNotNull (ex.ParamName, "#5");
1955 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1959 [Test] // bug #321735
1960 public void InvokeMember_SetFieldProperty ()
1962 ArrayList list = new ArrayList ();
1964 list.GetType ().InvokeMember ("Item",
1965 BindingFlags.SetField | BindingFlags.SetProperty |
1966 BindingFlags.Instance | BindingFlags.Public,
1967 null, list, new object [] { 0, "bar" });
1968 Assert.AreEqual ("bar", list [0]);
1972 public void InvokeMember_SetField_ProvidedArgs ()
1975 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1976 BindingFlags.Static | BindingFlags.SetField,
1977 null, null, new object [0]);
1978 Assert.Fail ("#A1");
1979 } catch (ArgumentException ex) {
1980 // Only the field value can be specified to set
1982 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1983 Assert.IsNull (ex.InnerException, "#A3");
1984 Assert.IsNotNull (ex.Message, "#A4");
1985 Assert.IsNotNull (ex.ParamName, "#A5");
1986 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1990 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1991 BindingFlags.Static | BindingFlags.SetField,
1993 Assert.Fail ("#B1");
1994 } catch (ArgumentNullException ex) {
1995 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
1996 Assert.IsNull (ex.InnerException, "#B3");
1997 Assert.IsNotNull (ex.Message, "#B4");
1998 Assert.IsNotNull (ex.ParamName, "#B5");
1999 Assert.AreEqual ("providedArgs", ex.ParamName, "#B6");
2003 [Test] // bug #336841
2004 [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306797
2005 public void InvokeMember_VarArgs ()
2007 BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.Public |
2008 BindingFlags.NonPublic | BindingFlags.OptionalParamBinding |
2009 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2010 BindingFlags.Instance;
2012 Type type = typeof (TypeTest);
2013 string result = (string) type.InvokeMember ("bug336841",
2014 flags, null, null, new object [] { "1" });
2015 Assert.IsNotNull (result, "#A1");
2016 Assert.AreEqual ("#B:1", result, "#A2");
2018 result = (string) type.InvokeMember ("bug336841", flags,
2019 null, null, new object [] { "1", "2", "3", "4" });
2020 Assert.IsNotNull (result, "#B1");
2021 Assert.AreEqual ("#A:1|2,3,4", result, "#B2");
2025 [Test] // bug #348522
2026 public void InvokeMember_WithoutDefaultValue ()
2028 BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;
2030 typeof (Bug348522).InvokeMember ("Test", flags, new FirstMethodBinder (), new Bug348522(),
2031 new object [] {Missing.Value}, null, null, null);
2033 } catch (ArgumentException ex) {
2034 // Missing parameter does not have a default value
2035 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2036 Assert.IsNull (ex.InnerException, "#3");
2037 Assert.IsNotNull (ex.Message, "#4");
2038 Assert.IsNotNull (ex.ParamName, "#5");
2039 Assert.AreEqual ("parameters", ex.ParamName, "#6");
2044 public void TestMissing () {
2045 Assert.AreEqual (Type.Missing, Missing.Value);
2049 public void InvokeMember_OutParam ()
2051 object[] args = new object[] { new string [0] };
2052 typeof (TypeTest).InvokeMember ("OutTest", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, args);
2053 Assert.IsTrue (args [0] is string[]);
2054 Assert.AreEqual (10, ((string[])args[0]).Length);
2057 public static void OutTest (out string[] a1)
2059 a1 = new string [10];
2064 public static int Value;
2073 public Z (IComparable value)
2078 public static void Run ()
2086 public TakesInt (int x)
2091 public int Integer {
2098 public TakesObject (object x) {}
2101 [Test] // bug #75241
2102 public void GetConstructorNullInTypes ()
2104 // This ends up calling type.GetConstructor ()
2105 Activator.CreateInstance (typeof (TakesInt), new object [] { null });
2106 Activator.CreateInstance (typeof (TakesObject), new object [] { null });
2110 public void GetConstructor_TakeInt_Object ()
2112 Assert.IsNull (typeof (TakesInt).GetConstructor (new Type[1] { typeof (object) }));
2116 public void GetCustomAttributes_All ()
2118 object [] attrs = typeof (A).GetCustomAttributes (false);
2119 Assert.AreEqual (2, attrs.Length, "#A1");
2120 Assert.IsTrue (HasAttribute (attrs, typeof (FooAttribute)), "#A2");
2121 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#A3");
2123 attrs = typeof (BA).GetCustomAttributes (false);
2124 Assert.AreEqual (1, attrs.Length, "#B1");
2125 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#B2");
2127 attrs = typeof (BA).GetCustomAttributes (true);
2128 Assert.AreEqual (2, attrs.Length, "#C1");
2129 Assert.IsTrue (HasAttribute (attrs, typeof (BarAttribute)), "#C2");
2130 Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#C3");
2132 attrs = typeof (CA).GetCustomAttributes (false);
2133 Assert.AreEqual (0, attrs.Length, "#D");
2135 attrs = typeof (CA).GetCustomAttributes (true);
2136 Assert.AreEqual (1, attrs.Length, "#E1");
2137 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E2");
2140 static bool HasAttribute (object [] attrs, Type attributeType)
2142 foreach (object attr in attrs)
2143 if (attr.GetType () == attributeType)
2149 public void GetCustomAttributes_Type ()
2151 object [] attrs = null;
2153 attrs = typeof (A).GetCustomAttributes (
2154 typeof (VolatileModifier), false);
2155 Assert.AreEqual (1, attrs.Length, "#A1");
2156 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A2");
2157 attrs = typeof (A).GetCustomAttributes (
2158 typeof (VolatileModifier), true);
2159 Assert.AreEqual (1, attrs.Length, "#A3");
2160 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A4");
2162 attrs = typeof (A).GetCustomAttributes (
2163 typeof (NemerleAttribute), false);
2164 Assert.AreEqual (1, attrs.Length, "#B1");
2165 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B2");
2166 attrs = typeof (A).GetCustomAttributes (
2167 typeof (NemerleAttribute), true);
2168 Assert.AreEqual (1, attrs.Length, "#B3");
2169 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B4");
2171 attrs = typeof (A).GetCustomAttributes (
2172 typeof (FooAttribute), false);
2173 Assert.AreEqual (1, attrs.Length, "#C1");
2174 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C2");
2175 attrs = typeof (A).GetCustomAttributes (
2176 typeof (FooAttribute), false);
2177 Assert.AreEqual (1, attrs.Length, "#C3");
2178 Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C4");
2180 attrs = typeof (BA).GetCustomAttributes (
2181 typeof (VolatileModifier), false);
2182 Assert.AreEqual (0, attrs.Length, "#D1");
2183 attrs = typeof (BA).GetCustomAttributes (
2184 typeof (VolatileModifier), true);
2185 Assert.AreEqual (1, attrs.Length, "#D2");
2186 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#D3");
2188 attrs = typeof (BA).GetCustomAttributes (
2189 typeof (NemerleAttribute), false);
2190 Assert.AreEqual (0, attrs.Length, "#E1");
2191 attrs = typeof (BA).GetCustomAttributes (
2192 typeof (NemerleAttribute), true);
2193 Assert.AreEqual (1, attrs.Length, "#E2");
2194 Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E3");
2196 attrs = typeof (BA).GetCustomAttributes (
2197 typeof (FooAttribute), false);
2198 Assert.AreEqual (1, attrs.Length, "#F1");
2199 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F2");
2200 attrs = typeof (BA).GetCustomAttributes (
2201 typeof (FooAttribute), true);
2202 Assert.AreEqual (1, attrs.Length, "#F3");
2203 Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F4");
2205 attrs = typeof (bug82431A1).GetCustomAttributes (
2206 typeof (InheritAttribute), false);
2207 Assert.AreEqual (1, attrs.Length, "#G1");
2208 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G2");
2209 attrs = typeof (bug82431A1).GetCustomAttributes (
2210 typeof (InheritAttribute), true);
2211 Assert.AreEqual (1, attrs.Length, "#G3");
2212 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G4");
2214 attrs = typeof (bug82431A1).GetCustomAttributes (
2215 typeof (NotInheritAttribute), false);
2216 Assert.AreEqual (1, attrs.Length, "#H1");
2217 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H2");
2218 attrs = typeof (bug82431A1).GetCustomAttributes (
2219 typeof (InheritAttribute), true);
2220 Assert.AreEqual (1, attrs.Length, "#H3");
2221 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H4");
2223 attrs = typeof (bug82431A2).GetCustomAttributes (
2224 typeof (InheritAttribute), false);
2225 Assert.AreEqual (0, attrs.Length, "#I1");
2226 attrs = typeof (bug82431A2).GetCustomAttributes (
2227 typeof (InheritAttribute), true);
2228 Assert.AreEqual (0, attrs.Length, "#I2");
2230 attrs = typeof (bug82431A2).GetCustomAttributes (
2231 typeof (NotInheritAttribute), false);
2232 Assert.AreEqual (0, attrs.Length, "#J1");
2233 attrs = typeof (bug82431A2).GetCustomAttributes (
2234 typeof (NotInheritAttribute), true);
2235 Assert.AreEqual (0, attrs.Length, "#J2");
2237 attrs = typeof (bug82431A3).GetCustomAttributes (
2238 typeof (InheritAttribute), false);
2239 Assert.AreEqual (2, attrs.Length, "#K1");
2240 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K2");
2241 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K3");
2242 attrs = typeof (bug82431A3).GetCustomAttributes (
2243 typeof (InheritAttribute), true);
2244 Assert.AreEqual (2, attrs.Length, "#K4");
2245 Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K5");
2246 Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K6");
2248 attrs = typeof (bug82431A3).GetCustomAttributes (
2249 typeof (NotInheritAttribute), false);
2250 Assert.AreEqual (1, attrs.Length, "#L1");
2251 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L2");
2252 attrs = typeof (bug82431A3).GetCustomAttributes (
2253 typeof (NotInheritAttribute), true);
2254 Assert.AreEqual (1, attrs.Length, "#L3");
2255 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L4");
2257 attrs = typeof (bug82431B1).GetCustomAttributes (
2258 typeof (InheritAttribute), false);
2259 Assert.AreEqual (1, attrs.Length, "#M1");
2260 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M2");
2261 attrs = typeof (bug82431B1).GetCustomAttributes (
2262 typeof (InheritAttribute), true);
2263 Assert.AreEqual (1, attrs.Length, "#M3");
2264 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M4");
2266 attrs = typeof (bug82431B1).GetCustomAttributes (
2267 typeof (NotInheritAttribute), false);
2268 Assert.AreEqual (0, attrs.Length, "#N1");
2269 attrs = typeof (bug82431B1).GetCustomAttributes (
2270 typeof (NotInheritAttribute), true);
2271 Assert.AreEqual (0, attrs.Length, "#N2");
2273 attrs = typeof (bug82431B2).GetCustomAttributes (
2274 typeof (InheritAttribute), false);
2275 Assert.AreEqual (0, attrs.Length, "#O1");
2276 attrs = typeof (bug82431B2).GetCustomAttributes (
2277 typeof (InheritAttribute), true);
2278 Assert.AreEqual (1, attrs.Length, "#O2");
2279 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#O3");
2281 attrs = typeof (bug82431B2).GetCustomAttributes (
2282 typeof (NotInheritAttribute), false);
2283 Assert.AreEqual (0, attrs.Length, "#P1");
2284 attrs = typeof (bug82431B2).GetCustomAttributes (
2285 typeof (NotInheritAttribute), true);
2286 Assert.AreEqual (0, attrs.Length, "#P2");
2288 attrs = typeof (bug82431B3).GetCustomAttributes (
2289 typeof (InheritAttribute), false);
2290 Assert.AreEqual (1, attrs.Length, "#Q1");
2291 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q2");
2292 attrs = typeof (bug82431B3).GetCustomAttributes (
2293 typeof (InheritAttribute), true);
2294 Assert.AreEqual (2, attrs.Length, "#Q3");
2295 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q4");
2296 Assert.AreEqual (typeof (InheritAttribute), attrs [1].GetType (), "#Q5");
2298 attrs = typeof (bug82431B3).GetCustomAttributes (
2299 typeof (NotInheritAttribute), false);
2300 Assert.AreEqual (1, attrs.Length, "#R1");
2301 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R2");
2302 attrs = typeof (bug82431B3).GetCustomAttributes (
2303 typeof (NotInheritAttribute), true);
2304 Assert.AreEqual (1, attrs.Length, "#R3");
2305 Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R4");
2307 attrs = typeof (bug82431B4).GetCustomAttributes (
2308 typeof (InheritAttribute), false);
2309 Assert.AreEqual (0, attrs.Length, "#S1");
2310 attrs = typeof (bug82431B4).GetCustomAttributes (
2311 typeof (InheritAttribute), true);
2312 Assert.AreEqual (1, attrs.Length, "#S2");
2313 Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#S3");
2315 attrs = typeof (bug82431B4).GetCustomAttributes (
2316 typeof (NotInheritAttribute), false);
2317 Assert.AreEqual (0, attrs.Length, "#T1");
2318 attrs = typeof (bug82431B4).GetCustomAttributes (
2319 typeof (NotInheritAttribute), true);
2320 Assert.AreEqual (0, attrs.Length, "#T2");
2322 attrs = typeof (A).GetCustomAttributes (
2323 typeof (string), false);
2324 Assert.AreEqual (0, attrs.Length, "#U1");
2325 attrs = typeof (A).GetCustomAttributes (
2326 typeof (string), true);
2327 Assert.AreEqual (0, attrs.Length, "#U2");
2330 [Test] // bug #76150
2331 public void IsDefined ()
2333 Assert.IsTrue (typeof (A).IsDefined (typeof (NemerleAttribute), false), "#A1");
2334 Assert.IsTrue (typeof (A).IsDefined (typeof (VolatileModifier), false), "#A2");
2335 Assert.IsTrue (typeof (A).IsDefined (typeof (FooAttribute), false), "#A3");
2336 Assert.IsFalse (typeof (A).IsDefined (typeof (BarAttribute), false), "#A4");
2338 Assert.IsFalse (typeof (BA).IsDefined (typeof (NemerleAttribute), false), "#B1");
2339 Assert.IsFalse (typeof (BA).IsDefined (typeof (VolatileModifier), false), "#B2");
2340 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), false), "#B3");
2341 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), false), "#B4");
2342 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), false), "#B5");
2343 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), false), "#B6");
2344 Assert.IsTrue (typeof (BA).IsDefined (typeof (NemerleAttribute), true), "#B7");
2345 Assert.IsTrue (typeof (BA).IsDefined (typeof (VolatileModifier), true), "#B8");
2346 Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), true), "#B9");
2347 Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), true), "#B10");
2348 Assert.IsFalse (typeof (BA).IsDefined (typeof (string), true), "#B11");
2349 Assert.IsFalse (typeof (BA).IsDefined (typeof (int), true), "#B12");
2353 public void IsDefined_AttributeType_Null ()
2356 typeof (BA).IsDefined ((Type) null, false);
2358 } catch (ArgumentNullException ex) {
2359 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2360 Assert.IsNull (ex.InnerException, "#3");
2361 Assert.IsNotNull (ex.Message, "#4");
2362 Assert.IsNotNull (ex.ParamName, "#5");
2363 Assert.AreEqual ("attributeType", ex.ParamName, "#6");
2367 [Test] // bug #82431
2368 [Category ("NotWorking")]
2369 public void IsDefined_Inherited ()
2371 Assert.IsFalse (typeof (CA).IsDefined (typeof (NemerleAttribute), false), "#C1");
2372 Assert.IsFalse (typeof (CA).IsDefined (typeof (VolatileModifier), false), "#C2");
2373 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), false), "#C3");
2374 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), false), "#C4");
2375 Assert.IsTrue (typeof (CA).IsDefined (typeof (NemerleAttribute), true), "#C5");
2376 Assert.IsTrue (typeof (CA).IsDefined (typeof (VolatileModifier), true), "#C6");
2377 Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), true), "#C7");
2378 Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), true), "#C8");
2380 Assert.IsFalse (typeof (BBA).IsDefined (typeof (NemerleAttribute), false), "#D1");
2381 Assert.IsFalse (typeof (BBA).IsDefined (typeof (VolatileModifier), false), "#D2");
2382 Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), false), "#D3");
2383 Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), false), "#D4");
2384 Assert.IsTrue (typeof (BBA).IsDefined (typeof (NemerleAttribute), true), "#D5");
2385 Assert.IsTrue (typeof (BBA).IsDefined (typeof (VolatileModifier), true), "#D6");
2386 Assert.IsTrue (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2387 Assert.IsTrue (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2389 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), false), "#E1");
2390 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), false), "#E2");
2391 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), true), "#E3");
2392 Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), true), "#E4");
2394 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), false), "#F1");
2395 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), false), "#F2");
2396 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2397 Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), true), "#F4");
2399 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), false), "#G1");
2400 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), false), "#G2");
2401 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), true), "#G3");
2402 Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), true), "#G4");
2404 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), false), "#H1");
2405 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), false), "#H2");
2406 Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), true), "#H3");
2407 Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), true), "#H4");
2409 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), false), "#I1");
2410 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), false), "#I2");
2411 Assert.IsTrue (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), true), "#I3");
2412 Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), true), "#I4");
2414 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), false), "#J1");
2415 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), false), "#J2");
2416 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), true), "#J3");
2417 Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), true), "#J4");
2419 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), false), "#K2");
2420 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), false), "#K2");
2421 Assert.IsTrue (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), true), "#K3");
2422 Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
2425 [Test] // GetType (String)
2426 public void GetType1_TypeName_Null ()
2429 Type.GetType ((string) null);
2431 } catch (ArgumentNullException ex) {
2432 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2433 Assert.IsNull (ex.InnerException, "#3");
2434 Assert.IsNotNull (ex.Message, "#4");
2435 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2439 [Test] // GetType (String, Boolean)
2440 public void GetType2_TypeName_Null ()
2443 Type.GetType ((string) null, false);
2445 } catch (ArgumentNullException ex) {
2446 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2447 Assert.IsNull (ex.InnerException, "#3");
2448 Assert.IsNotNull (ex.Message, "#4");
2449 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2453 [Test] // GetType (String, Boolean, Boolean)
2454 public void GetType3_TypeName_Null ()
2457 Type.GetType ((string) null, false, false);
2459 } catch (ArgumentNullException ex) {
2460 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2461 Assert.IsNull (ex.InnerException, "#3");
2462 Assert.IsNotNull (ex.Message, "#4");
2463 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2468 public void GetTypeArray_Args_Null ()
2471 Type.GetTypeArray ((object []) null);
2473 } catch (ArgumentNullException ex) {
2474 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2475 Assert.IsNull (ex.InnerException, "#3");
2476 Assert.IsNotNull (ex.Message, "#4");
2477 Assert.AreEqual ("args", ex.ParamName, "#5");
2482 public void GetTypeCode ()
2484 Assert.AreEqual (TypeCode.Boolean, Type.GetTypeCode (typeof (bool)), "#1");
2485 Assert.AreEqual (TypeCode.Byte, Type.GetTypeCode (typeof (byte)), "#2");
2486 Assert.AreEqual (TypeCode.Char, Type.GetTypeCode (typeof (char)), "#3");
2487 Assert.AreEqual (TypeCode.DateTime, Type.GetTypeCode (typeof (DateTime)), "#4");
2488 Assert.AreEqual (TypeCode.DBNull, Type.GetTypeCode (typeof (DBNull)), "#5");
2489 Assert.AreEqual (TypeCode.Decimal, Type.GetTypeCode (typeof (decimal)), "#6");
2490 Assert.AreEqual (TypeCode.Double, Type.GetTypeCode (typeof (double)), "#7");
2491 Assert.AreEqual (TypeCode.Empty, Type.GetTypeCode (null), "#8");
2492 Assert.AreEqual (TypeCode.Int16, Type.GetTypeCode (typeof (short)), "#9");
2493 Assert.AreEqual (TypeCode.Int32, Type.GetTypeCode (typeof (int)), "#10");
2494 Assert.AreEqual (TypeCode.Int64, Type.GetTypeCode (typeof (long)), "#11");
2495 Assert.AreEqual (TypeCode.Object, Type.GetTypeCode (typeof (TakesInt)), "#12");
2496 Assert.AreEqual (TypeCode.SByte, Type.GetTypeCode (typeof (sbyte)), "#13");
2497 Assert.AreEqual (TypeCode.Single, Type.GetTypeCode (typeof (float)), "#14");
2498 Assert.AreEqual (TypeCode.String, Type.GetTypeCode (typeof (string)), "#15");
2499 Assert.AreEqual (TypeCode.UInt16, Type.GetTypeCode (typeof (ushort)), "#16");
2500 Assert.AreEqual (TypeCode.UInt32, Type.GetTypeCode (typeof (uint)), "#17");
2501 Assert.AreEqual (TypeCode.UInt64, Type.GetTypeCode (typeof (ulong)), "#18");
2505 public void GetTypeFromHandle_Handle_Zero ()
2507 RuntimeTypeHandle handle = new RuntimeTypeHandle ();
2509 Assert.IsNull (Type.GetTypeFromHandle (handle));
2513 public void GetTypeHandle_O_Null ()
2516 Type.GetTypeHandle (null);
2518 } catch (ArgumentNullException ex) {
2519 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2520 Assert.IsNull (ex.InnerException, "#3");
2521 Assert.IsNotNull (ex.Message, "#4");
2522 Assert.IsNull (ex.ParamName, "#5");
2526 [Test] // GetConstructor (Type [])
2527 public void GetConstructor1 ()
2530 ConstructorInfo ctor;
2532 type = typeof (CtorsA);
2533 ctor = type.GetConstructor (Type.EmptyTypes);
2534 Assert.IsNotNull (ctor, "#A1");
2535 Assert.AreEqual (0, ctor.GetParameters ().Length, "#A2");
2536 Assert.IsFalse (ctor.IsStatic, "#A3");
2537 Assert.IsTrue (ctor.IsPublic, "#A4");
2538 Assert.AreEqual (".ctor", ctor.Name, "#A5");
2540 type = typeof (CtorsB);
2541 ctor = type.GetConstructor (Type.EmptyTypes);
2542 Assert.IsNotNull (ctor, "#B1");
2543 Assert.AreEqual (0, ctor.GetParameters ().Length, "#B2");
2544 Assert.IsFalse (ctor.IsStatic, "#B3");
2545 Assert.IsTrue (ctor.IsPublic, "#B4");
2546 Assert.AreEqual (".ctor", ctor.Name, "#B5");
2548 type = typeof (CtorsC);
2549 ctor = type.GetConstructor (Type.EmptyTypes);
2550 Assert.IsNull (ctor, "#C");
2552 type = typeof (CtorsC);
2553 ctor = type.GetConstructor (new Type [] { typeof (int) });
2554 Assert.IsNotNull (ctor, "#D1");
2555 Assert.AreEqual (1, ctor.GetParameters ().Length, "#D2");
2556 Assert.IsFalse (ctor.IsStatic, "#D3");
2557 Assert.IsTrue (ctor.IsPublic, "#D4");
2558 Assert.AreEqual (".ctor", ctor.Name, "#D5");
2561 [Test] // GetConstructor (Type [])
2562 public void GetConstructor1_Types_Null ()
2565 typeof (BindingFlags).GetConstructor (null);
2567 } catch (ArgumentNullException ex) {
2568 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2569 Assert.IsNull (ex.InnerException, "#3");
2570 Assert.IsNotNull (ex.Message, "#4");
2571 Assert.IsNotNull (ex.ParamName, "#5");
2572 Assert.AreEqual ("types", ex.ParamName, "#6");
2576 [Test] // GetConstructor (Type [])
2577 public void GetConstructor1_Types_ItemNull ()
2579 Type type = typeof (BindingFlags);
2581 type.GetConstructor (new Type[1] { null });
2582 Assert.Fail ("#A1");
2583 } catch (ArgumentNullException ex) {
2584 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
2585 Assert.IsNull (ex.InnerException, "#A3");
2586 Assert.IsNotNull (ex.Message, "#A4");
2587 Assert.IsNotNull (ex.ParamName, "#A5");
2588 Assert.AreEqual ("types", ex.ParamName, "#A6");
2591 type = typeof (TakesInt);
2593 type.GetConstructor (new Type [1] { null });
2594 Assert.Fail ("#B1");
2595 } catch (ArgumentNullException ex) {
2596 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2597 Assert.IsNull (ex.InnerException, "#B3");
2598 Assert.IsNotNull (ex.Message, "#B4");
2599 Assert.IsNotNull (ex.ParamName, "#B5");
2600 Assert.AreEqual ("types", ex.ParamName, "#B6");
2604 [Test] // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier [])
2605 public void GetConstructor2_Types_ItemNull ()
2607 Type type = typeof (BindingFlags);
2609 type.GetConstructor (BindingFlags.Default, null,
2610 new Type[1] { null }, null);
2612 } catch (ArgumentNullException ex) {
2613 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2614 Assert.IsNull (ex.InnerException, "#3");
2615 Assert.IsNotNull (ex.Message, "#4");
2616 Assert.IsNotNull (ex.ParamName, "#5");
2617 Assert.AreEqual ("types", ex.ParamName, "#6");
2621 [Test] // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier [])
2622 public void GetConstructor3_Types_ItemNull ()
2624 Type type = typeof (BindingFlags);
2626 type.GetConstructor (BindingFlags.Default,
2627 null, CallingConventions.Any,
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");
2640 public void GetMethod_Bug77367 ()
2642 MethodInfo i = typeof (Bug77367).GetMethod ("Run", Type.EmptyTypes);
2646 #if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM
2648 public void EqualsUnderlyingType ()
2650 AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
2651 TypeAttributes attribs = TypeAttributes.Public;
2653 AssemblyName name = new AssemblyName ();
2654 name.Name = "enumtest";
2655 AssemblyBuilder assembly =
2656 AppDomain.CurrentDomain.DefineDynamicAssembly (
2659 ModuleBuilder module = assembly.DefineDynamicModule
2660 ("m", "enumtest.dll");
2661 EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
2663 Assert.IsTrue (typeof (int).Equals (e));
2665 #endif // TARGET_JVM
2668 public void Equals_Type_Null ()
2670 Assert.IsFalse (typeof (int).Equals ((Type) null), "#1");
2671 Assert.IsFalse (typeof (int).Equals ((object) null), "#2");
2675 public void GetElementType_Bug63841 ()
2677 Assert.IsNull (typeof (TheEnum).GetElementType (), "#1");
2681 public void FullNameGenerics ()
2683 Type fooType = typeof (Foo<>);
2684 FieldInfo [] fields = fooType.GetFields ();
2686 Assert.AreEqual (1, fields.Length, "#0");
2688 Assert.IsNotNull (fooType.FullName, "#1");
2689 Assert.IsNotNull (fooType.AssemblyQualifiedName, "#1a");
2691 FieldInfo field = fooType.GetField ("Whatever");
2692 Assert.IsNotNull (field, "#2");
2693 Assert.AreEqual (field, fields [0], "#2a");
2694 Assert.IsNull (field.FieldType.FullName, "#3");
2695 Assert.IsNull (field.FieldType.AssemblyQualifiedName, "#3a");
2696 Assert.IsNotNull (field.FieldType.ToString (), "#4");
2698 PropertyInfo prop = fooType.GetProperty ("Test");
2699 Assert.IsNotNull (prop, "#5");
2700 Assert.IsNull (prop.PropertyType.FullName, "#6");
2701 Assert.IsNull (prop.PropertyType.AssemblyQualifiedName, "#6a");
2702 Assert.IsNotNull (prop.PropertyType.ToString (), "#7");
2704 MethodInfo method = fooType.GetMethod("Execute");
2705 Assert.IsNotNull (method, "#8");
2706 Assert.IsNull (method.ReturnType.FullName, "#9");
2707 Assert.IsNull (method.ReturnType.AssemblyQualifiedName, "#9a");
2708 Assert.IsNotNull (method.ReturnType.ToString (), "#10");
2710 ParameterInfo[] parameters = method.GetParameters();
2711 Assert.AreEqual (1, parameters.Length, "#11");
2712 Assert.IsNull (parameters[0].ParameterType.FullName, "#12");
2713 Assert.IsNull (parameters[0].ParameterType.AssemblyQualifiedName, "#12a");
2714 Assert.IsNotNull (parameters[0].ParameterType.ToString (), "#13");
2718 public void TypeParameterIsNotGeneric ()
2720 Type fooType = typeof (Foo<>);
2721 Type type_param = fooType.GetGenericArguments () [0];
2722 Assert.IsTrue (type_param.IsGenericParameter);
2723 Assert.IsFalse (type_param.IsGenericType);
2724 Assert.IsFalse (type_param.IsGenericTypeDefinition);
2726 // LAMESPEC: MSDN claims that this should be false, but .NET v2.0.50727 says it's true
2727 // http://msdn2.microsoft.com/en-us/library/system.type.isgenerictype.aspx
2728 Assert.IsTrue (type_param.ContainsGenericParameters);
2732 public void IsAssignable ()
2734 Type foo_type = typeof (Foo<>);
2735 Type foo_int_type = typeof (Foo<int>);
2736 Assert.IsFalse (foo_type.IsAssignableFrom (foo_int_type), "Foo<int> -!-> Foo<>");
2737 Assert.IsFalse (foo_int_type.IsAssignableFrom (foo_type), "Foo<> -!-> Foo<int>");
2739 Type ibar_short_type = typeof (IBar<short>);
2740 Type ibar_int_type = typeof (IBar<int>);
2741 Type baz_short_type = typeof (Baz<short>);
2742 Type baz_int_type = typeof (Baz<int>);
2744 Assert.IsTrue (ibar_int_type.IsAssignableFrom (baz_int_type), "Baz<int> -> IBar<int>");
2745 Assert.IsTrue (ibar_short_type.IsAssignableFrom (baz_short_type), "Baz<short> -> IBar<short>");
2747 Assert.IsFalse (ibar_int_type.IsAssignableFrom (baz_short_type), "Baz<short> -!-> IBar<int>");
2748 Assert.IsFalse (ibar_short_type.IsAssignableFrom (baz_int_type), "Baz<int> -!-> IBar<short>");
2751 Assert.IsTrue (typeof (Nullable<int>).IsAssignableFrom (typeof (int)));
2752 Assert.IsFalse (typeof (int).IsAssignableFrom (typeof (Nullable<int>)));
2753 Assert.IsTrue (typeof (Nullable<FooStruct>).IsAssignableFrom (typeof (FooStruct)));
2757 public void IsInstanceOf ()
2759 Assert.IsTrue (typeof (Nullable<int>).IsInstanceOfType (5));
2763 public void IsInstanceOfArrayOfNullable ()
2765 Assert.IsTrue (typeof (Nullable<int>[]).IsInstanceOfType (new Nullable<int> [0]));
2769 public void IsInstanceOfType_Null ()
2771 Assert.IsFalse (typeof (int).IsInstanceOfType (null), "int");
2772 Assert.IsFalse (typeof (object).IsInstanceOfType (null), "object");
2773 Assert.IsFalse (typeof (int?).IsInstanceOfType (null), "int?");
2777 public void ByrefType ()
2779 Type foo_type = typeof (Foo<>);
2780 Type type_param = foo_type.GetGenericArguments () [0];
2781 Type byref_type_param = type_param.MakeByRefType ();
2782 Assert.IsFalse (byref_type_param.IsGenericParameter);
2783 Assert.IsNull (byref_type_param.DeclaringType);
2787 [ExpectedException (typeof (TypeLoadException))]
2788 public void MakeByRefByRef ()
2790 typeof (int).MakeByRefType ().MakeByRefType ();
2794 public void MakeArrayTypeTest ()
2796 // This should not crash:
2797 typeof (void).MakeArrayType ();
2802 public class ComFoo<T> {
2806 public void GetCustomAttributesGenericInstance ()
2808 Assert.AreEqual (1, typeof (ComFoo<int>).GetCustomAttributes (typeof (ComVisibleAttribute), true).Length);
2811 interface ByRef1<T> { void f (ref T t); }
2812 interface ByRef2 { void f<T> (ref T t); }
2814 interface ByRef3<T> where T:struct { void f (ref T? t); }
2815 interface ByRef4 { void f<T> (ref T? t) where T:struct; }
2817 void CheckGenericByRef (Type t)
2819 string name = t.Name;
2820 t = t.GetMethod ("f").GetParameters () [0].ParameterType;
2822 Assert.IsFalse (t.IsGenericType, name);
2823 Assert.IsFalse (t.IsGenericTypeDefinition, name);
2824 Assert.IsFalse (t.IsGenericParameter, name);
2828 public void GenericByRef ()
2830 CheckGenericByRef (typeof (ByRef1<>));
2831 CheckGenericByRef (typeof (ByRef2));
2832 CheckGenericByRef (typeof (ByRef3<>));
2833 CheckGenericByRef (typeof (ByRef4));
2836 public class Bug80242<T> {
2837 public interface IFoo { }
2838 public class Bar : IFoo { }
2839 public class Baz : Bar { }
2843 public void TestNestedTypes ()
2845 Type t = typeof (Bug80242<object>);
2846 Assert.IsFalse (t.IsGenericTypeDefinition);
2847 foreach (Type u in t.GetNestedTypes ()) {
2848 Assert.IsTrue (u.IsGenericTypeDefinition, "{0} isn't a generic definition", u);
2849 Assert.AreEqual (u, u.GetGenericArguments () [0].DeclaringType);
2853 [Test] // bug #82211
2854 public void GetMembers_GenericArgument ()
2856 Type argType = typeof (ComFoo<>).GetGenericArguments () [0];
2857 MemberInfo [] members = argType.GetMembers ();
2858 Assert.IsNotNull (members, "#1");
2859 Assert.AreEqual (4, members.Length, "#2");
2863 [ExpectedException (typeof (ArgumentNullException))]
2864 public void ReflectionOnlyGetTypeNullTypeName ()
2866 Type.ReflectionOnlyGetType (null, false, false);
2870 public void ReflectionOnlyGetTypeDoNotThrow ()
2872 Assert.IsNull (Type.ReflectionOnlyGetType ("a, nonexistent.dll", false, false));
2876 [ExpectedException (typeof (FileNotFoundException))]
2877 public void ReflectionOnlyGetTypeThrow ()
2879 Type.ReflectionOnlyGetType ("a, nonexistent.dll", true, false);
2883 public void ReflectionOnlyGetType ()
2885 Type t = Type.ReflectionOnlyGetType (typeof (int).AssemblyQualifiedName.ToString (), true, true);
2886 Assert.AreEqual ("System.Int32", t.FullName);
2889 [Test] //bug #331199
2890 public void MakeGenericType_UserDefinedType ()
2892 Type ut = new UserType (typeof (int));
2893 Type t = typeof (Foo<>).MakeGenericType (ut);
2894 Assert.IsTrue (t.IsGenericType, "#A1");
2895 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2897 Type arg = t.GetGenericArguments () [0];
2898 Assert.IsNotNull (arg, "#B1");
2899 Assert.IsFalse (arg.IsGenericType, "#B2");
2900 Assert.AreEqual (ut, arg, "#B3");
2903 [Category ("NotWorking")]
2904 //We dont support instantiating a user type
2905 public void MakeGenericType_NestedUserDefinedType ()
2907 Type ut = new UserType (new UserType (typeof (int)));
2908 Type t = typeof (Foo<>).MakeGenericType (ut);
2909 Assert.IsTrue (t.IsGenericType, "#A1");
2910 Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2912 Type arg = t.GetGenericArguments () [0];
2913 Assert.IsNotNull (arg, "#B1");
2914 Assert.IsFalse (arg.IsGenericType, "#B2");
2915 Assert.AreEqual (ut, arg, "#B3");
2919 [Category ("NotWorking")]
2920 public void TestMakeGenericType_UserDefinedType_DotNet20SP1 ()
2922 Type ut = new UserType(typeof(int));
2923 Type t = typeof(Foo<>).MakeGenericType(ut);
2924 Assert.IsTrue (t.IsGenericType, "#1");
2926 Assert.AreEqual (ut, t.GetGenericArguments()[0], "#2");
2930 public void MakeGenericType_BadUserType ()
2932 Type ut = new UserType (null);
2934 Type t = typeof (Foo<>).MakeGenericType (ut);
2936 } catch (ArgumentException) {
2941 public void MakeGenericType_WrongNumOfArguments ()
2944 Type t = typeof (Foo<,>).MakeGenericType (new Type [] { typeof (int) });
2946 } catch (ArgumentException) {
2950 [AttributeUsage (AttributeTargets.All)]
2951 public class DocAttribute : Attribute {
2952 public DocAttribute (string docs) {}
2955 class GenericClassWithAttributes<[Doc ("T")] T, [Doc ("B")] B>
2956 where T : class, new ()
2959 public T Bar { get{return null;}}
2961 public void M<[Doc ("X")] X> (X x)
2966 [Test] //bug #377596
2967 public void GetGenericArguments_ArgumentsHaveAttributes ()
2969 Type type = typeof(GenericClassWithAttributes<,>);
2970 Type[] tArgs = type.GetGenericArguments ();
2971 MethodInfo m = type.GetMethod ("M");
2972 Type[] mArgs = m.GetGenericArguments ();
2973 Assert.AreEqual(1, tArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2974 Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2975 Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
2978 [Test] //bug #471255
2979 public void GetTypeCalledUsingReflection ()
2981 Type expectedType = Type.GetType ("NoNamespaceClass");
2982 Assert.IsNotNull (expectedType, "#1");
2983 MethodInfo m = typeof (Type).GetMethod ("GetType", BindingFlags.Public | BindingFlags.Static, null, new Type [] { typeof (string) }, null);
2984 object r = m.Invoke (null, BindingFlags.Default, null, new object [] { "NoNamespaceClass" }, CultureInfo.InvariantCulture);
2985 Assert.AreSame (expectedType, r, "#2");
2989 public void EqualsUserType () {
2990 UserType2 t1 = new UserType2(null);
2991 UserType2 t2 = new UserType2(t1);
2992 Assert.IsTrue (t1.Equals(t2));
2996 public void GetHashCodeUserType () {
2997 UserType2 t1 = new UserType2(null);
2998 UserType2 t2 = new UserType2(t1);
2999 Assert.AreEqual (42, t2.GetHashCode());
3003 public void IsGenericTypeDefinitionUserType () {
3004 Assert.IsFalse (new UserType(null).IsGenericTypeDefinition);
3008 public void IsGenericTypeUserType () {
3009 Assert.IsFalse (new UserType(null).IsGenericType);
3013 [ExpectedException (typeof (NotSupportedException))]
3014 public void GetGenericTypeDefinitionUserType () {
3015 new UserType(null).GetGenericTypeDefinition ();
3018 [ExpectedException (typeof (NotSupportedException))]
3019 public void GetGenericArgumentsUserType () {
3020 new UserType(null).GetGenericArguments ();
3024 [ExpectedException (typeof (InvalidOperationException))]
3025 public void GenericParameterPositionUserType () {
3026 Assert.IsTrue (new UserType(null).GenericParameterPosition == 0);
3030 public void TypeGetMemberReturnTypeTest ()
3033 MemberTypes memtype;
3035 object [] flagsandtypes = new object [] {
3036 MemberTypes.All, typeof (MemberInfo []),
3037 MemberTypes.Constructor, typeof (ConstructorInfo []),
3038 MemberTypes.Custom, typeof (MemberInfo []),
3039 MemberTypes.Event, typeof (EventInfo []),
3040 MemberTypes.Field, typeof (FieldInfo []),
3041 MemberTypes.Method, typeof (MethodInfo []),
3042 MemberTypes.NestedType, typeof (Type []),
3043 MemberTypes.Property, typeof (PropertyInfo []),
3044 MemberTypes.TypeInfo, typeof (Type [])};
3046 for (int i=0; i < flagsandtypes.Length; i+=2) {
3047 memtype = (MemberTypes)flagsandtypes [i];
3048 testtype = (Type)flagsandtypes [i+1];
3049 obj = GetType ().GetMember ("DummyMember", memtype,
3050 BindingFlags.Public | BindingFlags.Instance);
3051 Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
3052 "Expected " + testtype.FullName);
3058 public void TypeNameStartsWithSpace ()
3060 Type t1 = Type.GetType ("System.Type, mscorlib");
3061 Type t2 = Type.GetType (" System.Type, mscorlib");
3062 Assert.AreEqual (t1, t2);
3067 public void Bug506757 ()
3069 AssemblyName assemblyName = new AssemblyName ();
3070 assemblyName.Name = "customMod";
3071 assemblyName.Version = new Version (1, 2, 3, 4);
3073 AssemblyBuilder assembly
3074 = Thread.GetDomain().DefineDynamicAssembly(
3075 assemblyName, AssemblyBuilderAccess.RunAndSave);
3077 ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
3079 TypeBuilder type0 = module.DefineType ("Base", TypeAttributes.Public, typeof (object));
3080 TypeBuilder type1 = module.DefineType ("Middle", TypeAttributes.Public, type0);
3081 TypeBuilder type2 = module.DefineType ("End", TypeAttributes.Public, type1);
3083 MethodAttributes attrs0 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3084 MethodAttributes.NewSlot | MethodAttributes.FamORAssem;
3086 MethodAttributes attrs1 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3087 MethodAttributes.FamORAssem;
3089 MethodAttributes attrs2 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
3090 MethodAttributes.Public;
3093 MethodBuilder m0 = type0.DefineMethod ("Tst", attrs0, typeof (void), null);
3094 m0.GetILGenerator ().Emit (OpCodes.Ret);
3096 MethodBuilder m1 = type1.DefineMethod ("Tst", attrs1, typeof (void), null);
3097 m1.GetILGenerator ().Emit (OpCodes.Ret);
3099 MethodBuilder m2 = type2.DefineMethod ("Tst", attrs2, typeof (void), null);
3100 m2.GetILGenerator ().Emit (OpCodes.Ret);
3103 type0.CreateType ();
3104 type1.CreateType ();
3105 Type t2 = type2.CreateType ();
3107 foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
3108 Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
3112 public void MakeArrayTypeOfOneDimension ()
3114 Type vector = typeof (int).MakeArrayType ();
3115 Type szarray = typeof (int).MakeArrayType (1);
3117 Assert.AreNotEqual (vector, szarray, "#1");
3118 Assert.AreEqual ("Int32[]", vector.Name, "#2");
3119 Assert.AreEqual ("Int32[*]", szarray.Name, "#3");
3122 public class DeclaringMethodFoo {
3123 public void Test<T> (T t) {}
3124 public void Test2<T> (ref T t) {}
3127 public class DeclaringMethodBar<T> {
3128 public void Test2 (ref T t) {}
3132 public void DeclaringMethodOnlyWorksWithGenericArgs ()
3134 MethodInfo testMethod = typeof (DeclaringMethodFoo).GetMethod ("Test");
3135 MethodBase otherMethod = testMethod.GetParameters ()[0].ParameterType.DeclaringMethod;
3137 Assert.AreEqual (testMethod, otherMethod,"#1");
3139 Assert.IsNull (typeof (DeclaringMethodBar<>).GetGenericArguments ()[0].DeclaringMethod, "#2");
3142 var x = typeof (int).DeclaringMethod;
3144 } catch (InvalidOperationException) {}
3147 var x = typeof (DeclaringMethodFoo).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3149 } catch (InvalidOperationException) {}
3152 var x = typeof (DeclaringMethodBar<>).GetMethod ("Test2").GetParameters () [0].ParameterType.DeclaringMethod;
3154 } catch (InvalidOperationException) {}
3159 public void GetArrayRankThrowsForNonArrayType ()
3161 Assert.AreEqual (1, typeof (int[]).GetArrayRank (), "#1");
3162 Assert.AreEqual (2, typeof (int[,]).GetArrayRank (), "#2");
3164 typeof (int).GetArrayRank ();
3166 } catch (ArgumentException) {}
3169 [Test] //Bug #564379
3170 public void GetMethodsReturnPublicMethodsInInterfaces ()
3172 Type t = typeof (NonClosingStream);
3173 MethodInfo[] methods = t.GetMethods (BindingFlags.Public | BindingFlags.Instance);
3175 Assert.AreEqual (5, methods.Length, "#1");
3178 foreach (var m in methods) {
3179 if (m.Name.Equals ("ToString"))
3180 Assert.IsTrue (m.DeclaringType == typeof (NonClosingStream), "#" + id);
3181 else if (m.Name.Equals ("Dispose") && m.GetParameters ().Length == 0)
3182 Assert.IsTrue (m.DeclaringType == typeof (Stream), "#" + id);
3183 else if (m.Name.Equals ("Equals") || m.Name.Equals ("GetHashCode") || m.Name.Equals ("GetType"))
3184 Assert.IsTrue (m.DeclaringType == typeof (object), "#" + id);
3186 Assert.Fail ("invalid method " + m);
3191 public abstract class Stream : IDisposable
3193 public void Dispose ()
3195 Console.WriteLine ("stream::dispose");
3198 protected virtual void Dispose (bool disposing)
3203 public class NonClosingStream
3204 : Stream, IDisposable
3206 void IDisposable.Dispose()
3208 Console.WriteLine ("ncs::dispose");
3211 public override string ToString () { return ""; }
3214 static bool ContainsProperty (PropertyInfo [] props, string name)
3216 foreach (PropertyInfo p in props)
3222 public class NemerleAttribute : Attribute
3226 public class VolatileModifier : NemerleAttribute
3236 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3237 public class FooAttribute : Attribute
3241 public class BarAttribute : FooAttribute
3258 [AttributeUsage (AttributeTargets.Class, Inherited=true)]
3259 public class InheritAttribute : Attribute
3263 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3264 public class NotInheritAttribute : InheritAttribute
3268 [NotInheritAttribute]
3269 public class bug82431A1
3273 public class bug82431A2 : bug82431A1
3277 [NotInheritAttribute]
3279 public class bug82431A3 : bug82431A1
3284 public class bug82431B1
3288 public class bug82431B2 : bug82431B1
3292 [NotInheritAttribute]
3293 public class bug82431B3 : bug82431B2
3297 public class bug82431B4 : bug82431B3
3305 public class Bug77367
3307 public void Run (bool b)
3314 private string PrivInstBlue
3316 get { return null; }
3319 protected string ProtInstBlue
3321 get { return null; }
3324 protected internal string ProIntInstBlue
3326 get { return null; }
3329 public long PubInstBlue
3333 if (PrivInstBlue == null)
3335 return long.MaxValue;
3339 internal int IntInstBlue
3344 private static string PrivStatBlue
3346 get { return null; }
3349 protected static string ProtStatBlue
3351 get { return null; }
3354 protected static internal string ProIntStatBlue
3356 get { return null; }
3359 public static long PubStatBlue
3363 if (PrivStatBlue == null)
3365 return long.MaxValue;
3369 internal static int IntStatBlue
3375 public class Foo : Blue
3377 private string PrivInstBase
3379 get { return null; }
3382 protected string ProtInstBase
3384 get { return null; }
3387 protected internal string ProIntInstBase
3389 get { return null; }
3392 public long PubInstBase
3396 if (PrivInstBase == null)
3398 return long.MaxValue;
3402 internal int IntInstBase
3407 private static string PrivStatBase
3409 get { return null; }
3412 protected static string ProtStatBase
3414 get { return null; }
3417 protected static internal string ProIntStatBase
3419 get { return null; }
3422 public static long PubStatBase
3426 if (PrivStatBase == null)
3428 return long.MaxValue;
3432 internal static int IntStatBase
3438 public class Bar : Foo
3440 private string PrivInst
3442 get { return null; }
3445 protected string ProtInst
3447 get { return null; }
3450 protected internal string ProIntInst
3452 get { return null; }
3459 if (PrivInst == null)
3461 return long.MaxValue;
3465 internal int IntInst
3470 private static string PrivStat
3472 get { return null; }
3475 protected static string ProtStat
3477 get { return null; }
3480 protected static internal string ProIntStat
3482 get { return null; }
3485 public static long PubStat
3489 if (PrivStat == null)
3491 return long.MaxValue;
3495 internal static int IntStat
3521 public CtorsC (int x)
3527 class UserType : Type
3529 protected Type type;
3531 public UserType(Type type) {
3535 public override Type UnderlyingSystemType { get { return this.type; } }
3537 public override Assembly Assembly { get { return this.type == null ? null : this.type.Assembly; } }
3539 public override string AssemblyQualifiedName { get { return null; } }
3541 public override Type BaseType { get { return null; } }
3543 public override Module Module { get { return this.type.Module; } }
3545 public override string Namespace { get { return null; } }
3547 public override bool IsGenericParameter { get { return true; } }
3549 public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
3551 public override bool ContainsGenericParameters { get { return true; } }
3553 public override string FullName { get { return this.type.Name; } }
3555 public override Guid GUID { get { throw new NotSupportedException(); } }
3558 protected override bool IsArrayImpl() {
3562 protected override bool IsByRefImpl()
3567 protected override bool IsCOMObjectImpl()
3572 protected override bool IsPointerImpl()
3577 protected override bool IsPrimitiveImpl()
3583 protected override TypeAttributes GetAttributeFlagsImpl()
3588 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
3589 CallingConventions callConvention, Type[] types,
3590 ParameterModifier[] modifiers)
3595 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
3600 public override Type GetElementType()
3605 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
3611 public override FieldInfo GetField(string name, BindingFlags bindingAttr)
3617 public override Type GetInterface(string name, bool ignoreCase)
3622 public override Type[] GetInterfaces()
3627 public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
3632 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
3637 public override object[] GetCustomAttributes(bool inherit)
3642 public override bool IsDefined(Type attributeType, bool inherit)
3647 public override string Name { get { return this.type.Name; } }
3649 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
3651 throw new NotImplementedException();
3654 public override FieldInfo[] GetFields(BindingFlags bindingAttr)
3656 throw new NotImplementedException();
3659 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
3660 CallingConventions callConvention, Type[] types,
3661 ParameterModifier[] modifiers)
3666 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
3671 public override Type GetNestedType(string name, BindingFlags bindingAttr)
3676 public override Type[] GetNestedTypes(BindingFlags bindingAttr)
3681 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
3686 protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder,
3687 Type returnType, Type[] types, ParameterModifier[] modifiers)
3692 protected override bool HasElementTypeImpl()
3697 public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target,
3698 object[] args, ParameterModifier[] modifiers, CultureInfo culture,
3699 string[] namedParameters)
3701 throw new NotSupportedException();
3705 class UserType2 : UserType {
3706 public UserType2 (Type type) : base (type) {
3709 public override Type UnderlyingSystemType { get { return this.type ?? this; } }
3711 public override int GetHashCode()
3715 return type.GetHashCode();