PageRenderTime 56ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 1ms

/mcs/class/corlib/Test/System/TypeTest.cs

https://bitbucket.org/danipen/mono
C# | 4513 lines | 3837 code | 625 blank | 51 comment | 77 complexity | 2a5701da121846a8b9ef71f14a9b6932 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. // TypeTest.cs - NUnit Test Cases for the System.Type class
  2. //
  3. // Authors:
  4. // Zoltan Varga (vargaz@freemail.hu)
  5. // Patrik Torstensson
  6. //
  7. // (C) 2003 Ximian, Inc. http://www.ximian.com
  8. //
  9. using NUnit.Framework;
  10. using System;
  11. using System.Threading;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using System.IO;
  15. using System.Reflection;
  16. #if !MONOTOUCH
  17. using System.Reflection.Emit;
  18. #endif
  19. using System.Runtime.InteropServices;
  20. using System.Text;
  21. using System.Globalization;
  22. class NoNamespaceClass {
  23. }
  24. namespace MonoTests.System
  25. {
  26. class Super : ICloneable
  27. {
  28. public virtual object Clone ()
  29. {
  30. return null;
  31. }
  32. }
  33. class Duper: Super
  34. {
  35. }
  36. interface IFace1
  37. {
  38. void foo ();
  39. }
  40. interface IFace2 : IFace1
  41. {
  42. void bar ();
  43. }
  44. interface IFace3 : IFace2
  45. {
  46. }
  47. enum TheEnum
  48. {
  49. A,
  50. B,
  51. C
  52. };
  53. abstract class Base
  54. {
  55. public int level;
  56. public abstract int this [byte i] {
  57. get;
  58. }
  59. public abstract int this [int i] {
  60. get;
  61. }
  62. public abstract void TestVoid ();
  63. public abstract void TestInt (int i);
  64. }
  65. class DeriveVTable : Base
  66. {
  67. public override int this [byte i] {
  68. get { return 1; }
  69. }
  70. public override int this [int i] {
  71. get { return 1; }
  72. }
  73. public override void TestVoid ()
  74. {
  75. level = 1;
  76. }
  77. public override void TestInt (int i)
  78. {
  79. level = 1;
  80. }
  81. }
  82. class NewVTable : DeriveVTable
  83. {
  84. public new int this [byte i] {
  85. get { return 2; }
  86. }
  87. public new int this [int i] {
  88. get { return 2; }
  89. }
  90. public new void TestVoid ()
  91. {
  92. level = 2;
  93. }
  94. public new void TestInt (int i)
  95. {
  96. level = 2;
  97. }
  98. public void Overload ()
  99. {
  100. }
  101. public void Overload (int i)
  102. {
  103. }
  104. public NewVTable (out int i)
  105. {
  106. i = 0;
  107. }
  108. public void byref_method (out int i)
  109. {
  110. i = 0;
  111. }
  112. }
  113. class Base1
  114. {
  115. public virtual int Foo {
  116. get { return 1; }
  117. set { }
  118. }
  119. }
  120. class Derived1 : Base1
  121. {
  122. public override int Foo {
  123. set { }
  124. }
  125. }
  126. class Derived2 : Base1
  127. {
  128. public new int Foo {
  129. get { return 1; }
  130. set { }
  131. }
  132. }
  133. public class Foo<T>
  134. {
  135. public T Whatever;
  136. public T Test {
  137. get { throw new NotImplementedException (); }
  138. }
  139. public T Execute (T a)
  140. {
  141. return a;
  142. }
  143. public class Nested<K> {}
  144. }
  145. class Foo<T, U>
  146. {
  147. }
  148. public interface IBar<T>
  149. {
  150. }
  151. public class Baz<T> : IBar<T>
  152. {
  153. }
  154. class Gazonk {
  155. public static void Bang<S> () {}
  156. }
  157. public class Bug348522
  158. {
  159. public void Test (int __argument)
  160. {
  161. }
  162. }
  163. public class FirstMethodBinder : Binder
  164. {
  165. public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase [] match, ref object [] args,
  166. ParameterModifier [] modifiers, CultureInfo culture, string [] names,
  167. out object state)
  168. {
  169. state = null;
  170. return match [0];
  171. }
  172. public override object ChangeType (object value, Type type1, CultureInfo culture)
  173. {
  174. return value;
  175. }
  176. // The rest is just to please the compiler
  177. public override FieldInfo BindToField (BindingFlags a, FieldInfo[] b, object c, CultureInfo d)
  178. {
  179. return null;
  180. }
  181. public override void ReorderArgumentArray(ref object[] a, object b)
  182. {
  183. }
  184. public override MethodBase SelectMethod(BindingFlags a, MethodBase[] b, Type[] c, ParameterModifier[] d)
  185. {
  186. return null;
  187. }
  188. public override PropertyInfo SelectProperty(BindingFlags a, PropertyInfo[] b, Type c, Type[] d, ParameterModifier[] e)
  189. {
  190. return null;
  191. }
  192. }
  193. [TestFixture]
  194. public class TypeTest
  195. {
  196. #if !MONOTOUCH
  197. private ModuleBuilder module;
  198. #endif
  199. const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
  200. static int typeIndexer = 0;
  201. [SetUp]
  202. public void SetUp ()
  203. {
  204. AssemblyName assemblyName = new AssemblyName ();
  205. assemblyName.Name = ASSEMBLY_NAME;
  206. #if !MONOTOUCH
  207. var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
  208. assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
  209. module = assembly.DefineDynamicModule ("module1");
  210. #endif
  211. }
  212. private string genTypeName ()
  213. {
  214. return "t" + (typeIndexer++);
  215. }
  216. private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k)
  217. {
  218. }
  219. public interface IFace {
  220. }
  221. private void GenericMethod<Q, T1> (Q q, T1 t) where T1 : IFace
  222. {
  223. }
  224. [Test]
  225. public void TestIsAssignableFrom ()
  226. {
  227. // Simple tests for inheritance
  228. Assert.AreEqual (typeof (Super).IsAssignableFrom (typeof (Duper)) , true, "#01");
  229. Assert.AreEqual (typeof (Duper).IsAssignableFrom (typeof (Duper)), true, "#02");
  230. Assert.AreEqual (typeof (Object).IsAssignableFrom (typeof (Duper)), true, "#03");
  231. Assert.AreEqual (typeof (ICloneable).IsAssignableFrom (typeof (Duper)), true, "#04");
  232. // Tests for arrays
  233. Assert.AreEqual (typeof (Super[]).IsAssignableFrom (typeof (Duper[])), true, "#05");
  234. Assert.AreEqual (typeof (Duper[]).IsAssignableFrom (typeof (Super[])), false, "#06");
  235. Assert.AreEqual (typeof (Object[]).IsAssignableFrom (typeof (Duper[])), true, "#07");
  236. Assert.AreEqual (typeof (ICloneable[]).IsAssignableFrom (typeof (Duper[])), true, "#08");
  237. // Tests for multiple dimensional arrays
  238. Assert.AreEqual (typeof (Super[][]).IsAssignableFrom (typeof (Duper[][])), true, "#09");
  239. Assert.AreEqual (typeof (Duper[][]).IsAssignableFrom (typeof (Super[][])), false, "#10");
  240. Assert.AreEqual (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])), true, "#11");
  241. Assert.AreEqual (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])), true, "#12");
  242. // Tests for vectors<->one dimensional arrays */
  243. #if TARGET_JVM // Lower bounds arrays are not supported for TARGET_JVM.
  244. Array arr1 = Array.CreateInstance (typeof (int), new int[] {1});
  245. Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
  246. #else
  247. Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
  248. Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
  249. Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
  250. Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false, "#14");
  251. #endif // TARGET_JVM
  252. // Test that arrays of enums can be cast to their base types
  253. Assert.AreEqual (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])), true, "#15");
  254. // Test that arrays of valuetypes can't be cast to arrays of
  255. // references
  256. Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TypeCode[])), false, "#16");
  257. Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TypeCode[])), false, "#17");
  258. Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TypeCode[])), false, "#18");
  259. // Test that arrays of enums can't be cast to arrays of references
  260. Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TheEnum[])), false, "#19");
  261. Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TheEnum[])), false, "#20");
  262. Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TheEnum[])), false, "#21");
  263. // Check that ValueType and Enum are recognized as reference types
  264. Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (ValueType)), true, "#22");
  265. Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (Enum)), true, "#23");
  266. Assert.AreEqual (typeof (ValueType).IsAssignableFrom (typeof (Enum)), true, "#24");
  267. Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (ValueType[])), true, "#25");
  268. Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (ValueType[])), true, "#26");
  269. Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (ValueType[])), false, "#27");
  270. Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (Enum[])), true, "#28");
  271. Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (Enum[])), true, "#29");
  272. Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (Enum[])), true, "#30");
  273. // Tests for byref types
  274. MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
  275. Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
  276. Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
  277. // Tests for type parameters
  278. mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
  279. Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
  280. Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
  281. // Tests for parameters with generic constraints
  282. mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
  283. Assert.IsTrue (typeof (IFace).IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
  284. }
  285. [Test]
  286. [ExpectedException (typeof (ArgumentException))]
  287. public void GetInterfaceMapOnInterface ()
  288. {
  289. typeof (IList).GetInterfaceMap (typeof (ICollection));
  290. }
  291. [Test]
  292. public void TestIsSubclassOf ()
  293. {
  294. Assert.IsTrue (typeof (ICloneable).IsSubclassOf (typeof (object)), "#01");
  295. // Tests for byref types
  296. Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
  297. Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
  298. //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
  299. Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
  300. }
  301. [Test]
  302. public void TestGetMethodImpl ()
  303. {
  304. // Test binding of new slot methods (using no types)
  305. Assert.AreEqual (typeof (Base), typeof (Base).GetMethod("TestVoid").DeclaringType, "#01");
  306. Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestVoid").DeclaringType, "#02");
  307. // Test binding of new slot methods (using types)
  308. Assert.AreEqual (typeof (Base), typeof (Base).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#03");
  309. Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#04");
  310. // Test overload resolution
  311. Assert.AreEqual (0, typeof (NewVTable).GetMethod ("Overload", new Type[0]).GetParameters ().Length, "#05");
  312. // Test byref parameters
  313. Assert.AreEqual (null, typeof (NewVTable).GetMethod ("byref_method", new Type[] { typeof (int) }), "#06");
  314. Type byrefInt = typeof (NewVTable).GetMethod ("byref_method").GetParameters ()[0].ParameterType;
  315. Assert.IsNotNull (typeof (NewVTable).GetMethod ("byref_method", new Type[] { byrefInt }), "#07");
  316. }
  317. [Test]
  318. [Category ("TargetJvmNotWorking")]
  319. public void TestGetPropertyImpl ()
  320. {
  321. // Test getting property that is exact
  322. Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int32) }).DeclaringType, "#01");
  323. // Test getting property that is not exact
  324. Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int16) }).DeclaringType, "#02");
  325. // Test overriding of properties when only the set accessor is overriden
  326. Assert.AreEqual (1, typeof (Derived1).GetProperties ().Length, "#03");
  327. }
  328. [Test]
  329. public void GetProperties ()
  330. {
  331. // Test hide-by-name-and-signature
  332. Assert.AreEqual (1, typeof (Derived2).GetProperties ().Length);
  333. Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetProperties ()[0].DeclaringType);
  334. }
  335. [Test] // GetProperties (BindingFlags)
  336. public void GetProperties_Flags ()
  337. {
  338. PropertyInfo [] props;
  339. Type type = typeof (Bar);
  340. BindingFlags flags;
  341. flags = BindingFlags.Instance | BindingFlags.NonPublic;
  342. props = type.GetProperties (flags);
  343. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#A1");
  344. Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#A2");
  345. Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#A3");
  346. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#A4");
  347. Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#A5");
  348. Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#A6");
  349. Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#A7");
  350. Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#A8");
  351. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#A9");
  352. Assert.IsTrue (ContainsProperty (props, "IntInst"), "#A10");
  353. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#A11");
  354. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#A12");
  355. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#A13");
  356. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#A14");
  357. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#A15");
  358. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#A16");
  359. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#A17");
  360. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#A18");
  361. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#A19");
  362. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#A20");
  363. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#A21");
  364. Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#A22");
  365. Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#A23");
  366. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#A24");
  367. Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#A25");
  368. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#A26");
  369. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#A27");
  370. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#A28");
  371. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#A29");
  372. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#A30");
  373. flags = BindingFlags.Instance | BindingFlags.Public;
  374. props = type.GetProperties (flags);
  375. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#B1");
  376. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#B2");
  377. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#B3");
  378. Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#B4");
  379. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#B5");
  380. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#B6");
  381. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#B7");
  382. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#B8");
  383. Assert.IsTrue (ContainsProperty (props, "PubInst"), "#B9");
  384. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#B10");
  385. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#B11");
  386. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#B12");
  387. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#B13");
  388. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#B14");
  389. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#B15");
  390. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#B16");
  391. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#B17");
  392. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#B18");
  393. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#B19");
  394. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#B20");
  395. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#B21");
  396. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#B22");
  397. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#B23");
  398. Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#B24");
  399. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#B25");
  400. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#B26");
  401. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#B27");
  402. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#B28");
  403. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#B29");
  404. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#B30");
  405. flags = BindingFlags.Static | BindingFlags.Public;
  406. props = type.GetProperties (flags);
  407. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#C1");
  408. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#C2");
  409. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#C3");
  410. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#C4");
  411. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#C5");
  412. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#C6");
  413. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#C7");
  414. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#C8");
  415. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#C9");
  416. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#C10");
  417. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#C11");
  418. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#C12");
  419. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#C13");
  420. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#C14");
  421. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#C15");
  422. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#C16");
  423. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#C17");
  424. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#C18");
  425. Assert.IsTrue (ContainsProperty (props, "PubStat"), "#C19");
  426. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#C20");
  427. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#C21");
  428. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#C22");
  429. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#C23");
  430. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#C24");
  431. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#C25");
  432. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#C26");
  433. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#C27");
  434. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#C28");
  435. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#C29");
  436. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#C30");
  437. flags = BindingFlags.Static | BindingFlags.NonPublic;
  438. props = type.GetProperties (flags);
  439. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#D1");
  440. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#D2");
  441. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#D3");
  442. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#D4");
  443. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#D5");
  444. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#D6");
  445. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#D7");
  446. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#D8");
  447. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#D9");
  448. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#D10");
  449. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#D11");
  450. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#D12");
  451. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#D13");
  452. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#D14");
  453. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#D15");
  454. Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#D16");
  455. Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#D17");
  456. Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#D18");
  457. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#D19");
  458. Assert.IsTrue (ContainsProperty (props, "IntStat"), "#D20");
  459. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#D21");
  460. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#D22");
  461. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#D23");
  462. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#D24");
  463. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#D25");
  464. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#D26");
  465. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#D27");
  466. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#D28");
  467. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#D29");
  468. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#D30");
  469. flags = BindingFlags.Instance | BindingFlags.NonPublic |
  470. BindingFlags.FlattenHierarchy;
  471. props = type.GetProperties (flags);
  472. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#E1");
  473. Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#E2");
  474. Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#E3");
  475. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#E4");
  476. Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#E5");
  477. Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#E6");
  478. Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#E7");
  479. Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#E8");
  480. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#E9");
  481. Assert.IsTrue (ContainsProperty (props, "IntInst"), "#E10");
  482. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#E11");
  483. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#E12");
  484. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#E13");
  485. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#E14");
  486. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#E15");
  487. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#E16");
  488. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#E17");
  489. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#E18");
  490. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#E19");
  491. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#E20");
  492. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#E21");
  493. Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#E22");
  494. Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#E23");
  495. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#E24");
  496. Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#E25");
  497. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#E26");
  498. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#E27");
  499. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#E28");
  500. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#E29");
  501. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#E30");
  502. flags = BindingFlags.Instance | BindingFlags.Public |
  503. BindingFlags.FlattenHierarchy;
  504. props = type.GetProperties (flags);
  505. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#F1");
  506. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#F2");
  507. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#F3");
  508. Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#F4");
  509. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#F5");
  510. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#F6");
  511. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#F7");
  512. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#F8");
  513. Assert.IsTrue (ContainsProperty (props, "PubInst"), "#F9");
  514. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#F10");
  515. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#F11");
  516. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#F12");
  517. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#F13");
  518. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#F14");
  519. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#F15");
  520. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#F16");
  521. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#F17");
  522. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#F18");
  523. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#F19");
  524. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#F20");
  525. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#F21");
  526. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#F22");
  527. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#F23");
  528. Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#F24");
  529. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#F25");
  530. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#F26");
  531. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#F27");
  532. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#F28");
  533. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#F29");
  534. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#F30");
  535. flags = BindingFlags.Static | BindingFlags.Public |
  536. BindingFlags.FlattenHierarchy;
  537. props = type.GetProperties (flags);
  538. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#G1");
  539. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#G2");
  540. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#G3");
  541. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#G4");
  542. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#G5");
  543. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#G6");
  544. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#G7");
  545. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#G8");
  546. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#G9");
  547. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#G10");
  548. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#G11");
  549. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#G12");
  550. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#G13");
  551. Assert.IsTrue (ContainsProperty (props, "PubStatBase"), "#G14");
  552. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#G15");
  553. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#G16");
  554. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#G17");
  555. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#G18");
  556. Assert.IsTrue (ContainsProperty (props, "PubStat"), "#G19");
  557. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#G20");
  558. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#G21");
  559. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#G22");
  560. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#G23");
  561. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#G24");
  562. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#G25");
  563. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#G26");
  564. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#G27");
  565. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#G28");
  566. Assert.IsTrue (ContainsProperty (props, "PubStatBlue"), "#G29");
  567. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#G30");
  568. flags = BindingFlags.Static | BindingFlags.NonPublic |
  569. BindingFlags.FlattenHierarchy;
  570. props = type.GetProperties (flags);
  571. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#H1");
  572. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#H2");
  573. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#H3");
  574. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#H4");
  575. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#H5");
  576. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#H6");
  577. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#H7");
  578. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#H8");
  579. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#H9");
  580. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#H10");
  581. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#H11");
  582. Assert.IsTrue (ContainsProperty (props, "ProtStatBase"), "#H12");
  583. Assert.IsTrue (ContainsProperty (props, "ProIntStatBase"), "#H13");
  584. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#H14");
  585. Assert.IsTrue (ContainsProperty (props, "IntStatBase"), "#H15");
  586. Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#H16");
  587. Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#H17");
  588. Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#H18");
  589. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#H19");
  590. Assert.IsTrue (ContainsProperty (props, "IntStat"), "#H20");
  591. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#H21");
  592. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#H22");
  593. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#H23");
  594. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#H24");
  595. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#H25");
  596. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#H26");
  597. Assert.IsTrue (ContainsProperty (props, "ProtStatBlue"), "#H27");
  598. Assert.IsTrue (ContainsProperty (props, "ProIntStatBlue"), "#H28");
  599. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#H29");
  600. Assert.IsTrue (ContainsProperty (props, "IntStatBlue"), "#H30");
  601. flags = BindingFlags.Instance | BindingFlags.NonPublic |
  602. BindingFlags.DeclaredOnly;
  603. props = type.GetProperties (flags);
  604. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#I1");
  605. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#I2");
  606. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#I3");
  607. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#I4");
  608. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#I5");
  609. Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#I6");
  610. Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#I7");
  611. Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#I8");
  612. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#I9");
  613. Assert.IsTrue (ContainsProperty (props, "IntInst"), "#I10");
  614. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#I11");
  615. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#I12");
  616. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#I13");
  617. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#I14");
  618. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#I15");
  619. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#I16");
  620. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#I17");
  621. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#I18");
  622. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#I19");
  623. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#I20");
  624. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#I21");
  625. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#I22");
  626. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#I23");
  627. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#I24");
  628. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#I25");
  629. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#I26");
  630. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#I27");
  631. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#I28");
  632. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#I29");
  633. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#I30");
  634. flags = BindingFlags.Instance | BindingFlags.Public |
  635. BindingFlags.DeclaredOnly;
  636. props = type.GetProperties (flags);
  637. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#J1");
  638. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#J2");
  639. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#J3");
  640. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#J4");
  641. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#J5");
  642. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#J6");
  643. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#J7");
  644. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#J8");
  645. Assert.IsTrue (ContainsProperty (props, "PubInst"), "#J9");
  646. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#J10");
  647. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#J11");
  648. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#J12");
  649. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#J13");
  650. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#J14");
  651. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#J15");
  652. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#J16");
  653. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#J17");
  654. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#J18");
  655. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#J19");
  656. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#J20");
  657. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#J21");
  658. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#J22");
  659. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#J23");
  660. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#J24");
  661. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#J25");
  662. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#J26");
  663. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#J27");
  664. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#J28");
  665. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#J29");
  666. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#J30");
  667. flags = BindingFlags.Static | BindingFlags.Public |
  668. BindingFlags.DeclaredOnly;
  669. props = type.GetProperties (flags);
  670. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#K1");
  671. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#K2");
  672. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#K3");
  673. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#K4");
  674. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#K5");
  675. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#K6");
  676. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#K7");
  677. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#K8");
  678. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#K9");
  679. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#K10");
  680. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#K11");
  681. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#K12");
  682. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#K13");
  683. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#K14");
  684. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#K15");
  685. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#K16");
  686. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#K17");
  687. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#K18");
  688. Assert.IsTrue (ContainsProperty (props, "PubStat"), "#K19");
  689. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#K20");
  690. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#K21");
  691. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#K22");
  692. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#K23");
  693. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#K24");
  694. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#K25");
  695. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#K26");
  696. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#K27");
  697. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#K28");
  698. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#K29");
  699. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#K30");
  700. flags = BindingFlags.Static | BindingFlags.NonPublic |
  701. BindingFlags.DeclaredOnly;
  702. props = type.GetProperties (flags);
  703. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#L1");
  704. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#L2");
  705. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#L3");
  706. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#L4");
  707. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#L5");
  708. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#L6");
  709. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#L7");
  710. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#L8");
  711. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#L9");
  712. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#L10");
  713. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#L11");
  714. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#L12");
  715. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#L13");
  716. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#L14");
  717. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#L15");
  718. Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#L16");
  719. Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#L17");
  720. Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#L18");
  721. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#L19");
  722. Assert.IsTrue (ContainsProperty (props, "IntStat"), "#L20");
  723. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#L21");
  724. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#L22");
  725. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#L23");
  726. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#L24");
  727. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#L25");
  728. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#L26");
  729. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#L27");
  730. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#L28");
  731. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#L29");
  732. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#L30");
  733. flags = BindingFlags.Instance | BindingFlags.NonPublic |
  734. BindingFlags.Public;
  735. props = type.GetProperties (flags);
  736. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#M1");
  737. Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#M2");
  738. Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#M3");
  739. Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#M4");
  740. Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#M5");
  741. Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#M6");
  742. Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#M7");
  743. Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#M8");
  744. Assert.IsTrue (ContainsProperty (props, "PubInst"), "#M9");
  745. Assert.IsTrue (ContainsProperty (props, "IntInst"), "#M10");
  746. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#M11");
  747. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#M12");
  748. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#M13");
  749. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#M14");
  750. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#M15");
  751. Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#M16");
  752. Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#M17");
  753. Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#M18");
  754. Assert.IsFalse (ContainsProperty (props, "PubStat"), "#M19");
  755. Assert.IsFalse (ContainsProperty (props, "IntStat"), "#M20");
  756. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#M21");
  757. Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#M22");
  758. Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#M23");
  759. Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#M24");
  760. Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#M25");
  761. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#M26");
  762. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#M27");
  763. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#M28");
  764. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#M29");
  765. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#M30");
  766. flags = BindingFlags.Static | BindingFlags.NonPublic |
  767. BindingFlags.Public;
  768. props = type.GetProperties (flags);
  769. Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#N1");
  770. Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#N2");
  771. Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#N3");
  772. Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#N4");
  773. Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#N5");
  774. Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#N6");
  775. Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#N7");
  776. Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#N8");
  777. Assert.IsFalse (ContainsProperty (props, "PubInst"), "#N9");
  778. Assert.IsFalse (ContainsProperty (props, "IntInst"), "#N10");
  779. Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#N11");
  780. Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#N12");
  781. Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#N13");
  782. Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#N14");
  783. Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#N15");
  784. Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#N16");
  785. Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#N17");
  786. Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#N18");
  787. Assert.IsTrue (ContainsProperty (props, "PubStat"), "#N19");
  788. Assert.IsTrue (ContainsProperty (props, "IntStat"), "#N20");
  789. Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#N21");
  790. Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#N22");
  791. Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#N23");
  792. Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#N24");
  793. Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#N25");
  794. Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#N26");
  795. Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#N27");
  796. Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#N28");
  797. Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#N29");
  798. Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#N30");
  799. }
  800. [Test] // GetProperty (String)
  801. public void GetProperty1_Name_Null ()
  802. {
  803. Type type = typeof (Bar);
  804. try {
  805. type.GetProperty ((string) null);
  806. Assert.Fail ("#1");
  807. } catch (ArgumentNullException ex) {
  808. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  809. Assert.IsNull (ex.InnerException, "#3");
  810. Assert.IsNotNull (ex.Message, "#4");
  811. Assert.IsNotNull (ex.ParamName, "#5");
  812. Assert.AreEqual ("name", ex.ParamName, "#6");
  813. }
  814. }
  815. [Test] // GetProperty (String, BindingFlags)
  816. public void GetProperty2 ()
  817. {
  818. Type type = typeof (Bar);
  819. BindingFlags flags;
  820. flags = BindingFlags.Instance | BindingFlags.NonPublic;
  821. Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#A1");
  822. Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#A2");
  823. Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#A3");
  824. Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#A4");
  825. Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#A5");
  826. Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#A6");
  827. Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#A7");
  828. Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#A8");
  829. Assert.IsNull (type.GetProperty ("PubInst", flags), "#A9");
  830. Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#A10");
  831. Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#A11");
  832. Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#A12");
  833. Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#A13");
  834. Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#A14");
  835. Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#A15");
  836. Assert.IsNull (type.GetProperty ("PrivStat", flags), "#A16");
  837. Assert.IsNull (type.GetProperty ("ProtStat", flags), "#A17");
  838. Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#A18");
  839. Assert.IsNull (type.GetProperty ("PubStat", flags), "#A19");
  840. Assert.IsNull (type.GetProperty ("IntStat", flags), "#A20");
  841. Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#A21");
  842. Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#A22");
  843. Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#A23");
  844. Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#A24");
  845. Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#A25");
  846. Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#A26");
  847. Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#A27");
  848. Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#A28");
  849. Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#A29");
  850. Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#A30");
  851. flags = BindingFlags.Instance | BindingFlags.Public;
  852. Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#B1");
  853. Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#B2");
  854. Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#B3");
  855. Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#B4");
  856. Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#B5");
  857. Assert.IsNull (type.GetProperty ("PrivInst", flags), "#B6");
  858. Assert.IsNull (type.GetProperty ("ProtInst", flags), "#B7");
  859. Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#B8");
  860. Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#B9");
  861. Assert.IsNull (type.GetProperty ("IntInst", flags), "#B10");
  862. Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#B11");
  863. Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#B12");
  864. Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#B13");
  865. Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#B14");
  866. Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#B15");
  867. Assert.IsNull (type.GetProperty ("PrivStat", flags), "#B16");
  868. Assert.IsNull (type.GetProperty ("ProtStat", flags), "#B17");
  869. Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#B18");
  870. Assert.IsNull (type.GetProperty ("PubStat", flags), "#B19");
  871. Assert.IsNull (type.GetProperty ("IntStat", flags), "#B20");
  872. Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#B21");
  873. Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#B22");
  874. Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#B23");
  875. Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#B24");
  876. Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#B25");
  877. Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#B26");
  878. Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#B27");
  879. Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#B28");
  880. Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#B29");
  881. Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#B30");
  882. flags = BindingFlags.Static | BindingFlags.Public;
  883. Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#C1");
  884. Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#C2");
  885. Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#C3");
  886. Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#C4");
  887. Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#C5");
  888. Assert.IsNull (type.GetProperty ("PrivInst", flags), "#C6");
  889. Assert.IsNull (type.GetProperty ("ProtInst", flags), "#C7");
  890. Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#C8");
  891. Assert.IsNull (type.GetProperty ("PubInst", flags), "#C9");
  892. Assert.IsNull (type.GetProperty ("IntInst", flags), "#C10");
  893. Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#C11");
  894. Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#C12");
  895. Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#C13");
  896. Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#C14");
  897. Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#C15");
  898. Assert.IsNull (type.GetProperty ("PrivStat", flags), "#C16");
  899. Assert.IsNull (type.GetProperty ("ProtStat", flags), "#C17");
  900. Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#C18");
  901. Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#C19");
  902. Assert.IsNull (type.GetProperty ("IntStat", flags), "#C20");
  903. Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#C21");
  904. Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#C22");
  905. Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#C23");
  906. Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#C24");
  907. Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#C25");
  908. Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#C26");
  909. Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#C27");
  910. Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#C28");
  911. Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#C29");
  912. Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#C30");
  913. flags = BindingFlags.Static | BindingFlags.NonPublic;
  914. Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#D1");
  915. Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#D2");
  916. Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#D3");
  917. Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#D4");
  918. Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#D5");
  919. Assert.IsNull (type.GetProperty ("PrivInst", flags), "#D6");
  920. Assert.IsNull (type.GetProperty ("ProtInst", flags), "#D7");
  921. Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#D8");
  922. Assert.IsNull (type.GetProperty ("PubInst", flags), "#D9");
  923. Assert.IsNull (type.GetProperty ("IntInst", flags), "#D10");
  924. Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#D11");
  925. Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#D12");
  926. Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#D13");
  927. Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#D14");
  928. Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#D15");
  929. Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#D16");
  930. Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#D17");

Large files files are truncated, but you can click here to view the full file