Browse Source

2008-01-29 Zoltan Varga <[email protected]>

	* ModuleBuilderTest.cs: Add tests for GetTypes ().

svn path=/trunk/mcs/; revision=94295
Zoltan Varga 18 years ago
parent
commit
87bfb8ce03

+ 2 - 0
mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog

@@ -1,5 +1,7 @@
 2008-01-29  Zoltan Varga  <[email protected]>
 
+	* ModuleBuilderTest.cs: Add tests for GetTypes ().
+
 	* AssemblyBuilderTest.cs (GetModule): Add some tests and comment out one which
 	doesn't run on mono.
 

+ 19 - 0
mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs

@@ -239,5 +239,24 @@ namespace MonoTests.System.Reflection.Emit
 			mb.ResolveField (0x4001234);
 		}
 #endif
+
+		[Test]
+		public void GetTypes ()
+		{
+			AssemblyBuilder ab = genAssembly ();
+			ModuleBuilder mb = ab.DefineDynamicModule ("foo.dll", "foo.dll");
+			
+            TypeBuilder tb1 = mb.DefineType("Foo", TypeAttributes.Public);
+			
+			Type[] types = mb.GetTypes ();
+			Assert.AreEqual (1, types.Length);
+			Assert.AreEqual (tb1, types [0]);
+
+			// After the type is created, MS seems to return the created type
+			tb1.CreateType ();
+
+			types = mb.GetTypes ();
+			Assert.AreEqual (tb1.CreateType (), types [0]);
+		}
 	}
 }