فهرست منبع

2003-05-19 Zoltan Varga <[email protected]>

	* AssemblyBuilderTest.cs: More tests.

svn path=/trunk/mcs/; revision=14705
Zoltan Varga 22 سال پیش
والد
کامیت
bef0980eee

+ 62 - 9
mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs

@@ -34,9 +34,12 @@ public class AssemblyBuilderTest : Assertion
 
 	static AppDomain domain;
 
+	static AssemblyBuilder ab;
+
 	[SetUp]
 	protected void SetUp () {
 		domain = Thread.GetDomain ();
+		ab = genAssembly ();
 	}
 
 	private AssemblyName genAssemblyName () {
@@ -60,8 +63,6 @@ public class AssemblyBuilderTest : Assertion
 	}
 
 	public void TestCodeBase () {
-		AssemblyBuilder ab = genAssembly ();
-
 		try {
 			string codebase = ab.CodeBase;
 			Fail ();
@@ -71,8 +72,6 @@ public class AssemblyBuilderTest : Assertion
 	}
 
 	public void TestEntryPoint () {
-		AssemblyBuilder ab = genAssembly ();
-
 		AssertEquals ("EntryPoint defaults to null",
 					  null, ab.EntryPoint);
 
@@ -83,8 +82,6 @@ public class AssemblyBuilderTest : Assertion
 	}
 
 	public void TestSetEntryPoint () {
-		AssemblyBuilder ab = genAssembly ();
-
 		// Check invalid arguments
 		try {
 			ab.SetEntryPoint (null);
@@ -103,8 +100,6 @@ public class AssemblyBuilderTest : Assertion
 	}
 
 	public void TestIsDefined () {
-		AssemblyBuilder ab = genAssembly ();
-
 		CustomAttributeBuilder cab = new CustomAttributeBuilder (typeof (FooAttribute).GetConstructor (new Type [1] {typeof (string)}), new object [1] { "A" });
 		ab.SetCustomAttribute (cab);
 
@@ -114,7 +109,65 @@ public class AssemblyBuilderTest : Assertion
 					  false, ab.IsDefined (typeof (AssemblyVersionAttribute), false));
 	}
 
-	
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetManifestResourceNames () {
+		ab.GetManifestResourceNames ();
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetManifestResourceInfo () {
+		ab.GetManifestResourceInfo ("foo");
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetManifestResourceStream1 () {
+		ab.GetManifestResourceStream ("foo");
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetManifestResourceStream2 () {
+		ab.GetManifestResourceStream (typeof (int), "foo");
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetFiles1 () {
+		ab.GetFiles ();
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetFiles2 () {
+		ab.GetFiles (true);
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetFile () {
+		ab.GetFile ("foo");
+	}
+
+	[ExpectedException (typeof (NotSupportedException))]
+	public void TestGetExportedTypes () {
+		ab.GetExportedTypes ();
+	}
+
+	[ExpectedException (typeof (ArgumentNullException))]
+	public void TestGetDynamicModule1 () {
+		ab.GetDynamicModule (null);
+	}
+
+	[ExpectedException (typeof (ArgumentException))]
+	public void TestGetDynamicModule2 () {
+		ab.GetDynamicModule ("");
+	}
+
+	public void TestGetDynamicModule3 () {
+		AssertNull (ab.GetDynamicModule ("FOO2"));
+
+		ModuleBuilder mb = ab.DefineDynamicModule ("FOO");
+
+		AssertEquals (mb, ab.GetDynamicModule ("FOO"));
+
+		AssertNull (ab.GetDynamicModule ("FOO4"));
+	}
 }
 }
 

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

@@ -1,3 +1,7 @@
+2003-05-19  Zoltan Varga  <[email protected]>
+
+	* AssemblyBuilderTest.cs: More tests.
+
 2003-05-12  Zoltan Varga  <[email protected]>
 
 	* MethodBuilderTest.cs: Comment out test which fails because of a mono