3 using System
.Reflection
;
5 public class TestAssemblyLoad
{
7 public static int Main ()
9 return TestDriver
.RunTests (typeof (TestAssemblyLoad
));
12 public static int test_0_LoadBytesSameAssemblyName ()
15 string path1
= Path
.Combine (AppDomain
.CurrentDomain
.BaseDirectory
, "assembly-load-dir1", "Lib.dll");
16 string path2
= Path
.Combine (AppDomain
.CurrentDomain
.BaseDirectory
, "assembly-load-dir2", "Lib.dll");
17 byte[] bytes1
= File
.ReadAllBytes (path1
);
18 byte[] bytes2
= File
.ReadAllBytes (path2
);
20 Assembly asm1
= Assembly
.Load (bytes1
);
21 Assembly asm2
= Assembly
.Load (bytes2
);
23 Console
.Error
.WriteLine ("expected asm1 {0} and asm2 {1} to be different", asm1
, asm2
);
27 Type t1
= asm1
.GetType ("LibClass");
28 Type t2
= asm2
.GetType ("LibClass");
30 Console
.Error
.WriteLine ("expected t1 {0} and t2 {1} to be different", t1
, t2
);
34 object o1
= Activator
.CreateInstance (t1
);
35 object o2
= Activator
.CreateInstance (t2
);
37 string s1
= o1
.ToString ();
38 string s2
= o2
.ToString ();
41 Console
.Error
.WriteLine ("expected string s1 {0} and s2 {1} to be different", s1
, s2
);