[netcore] Ongoing work. (#13391)
[mono-project.git] / mono / tests / assembly-loadfile.cs
blob893524caf8af84d7351fc0a11553c85ef72b3d74
1 using System;
2 using System.IO;
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_LoadFileSameAssemblyName ()
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");
18 Assembly asm1 = Assembly.LoadFile (path1);
19 Assembly asm2 = Assembly.LoadFile (path2);
20 if (asm1 == asm2) {
21 Console.Error.WriteLine ("expected asm1 {0} and asm2 {1} to be different", asm1, asm2);
22 return 1;
25 Type t1 = asm1.GetType ("LibClass");
26 Type t2 = asm2.GetType ("LibClass");
27 if (t1 == t2) {
28 Console.Error.WriteLine ("expected t1 {0} and t2 {1} to be different", t1, t2);
29 return 2;
32 object o1 = Activator.CreateInstance (t1);
33 object o2 = Activator.CreateInstance (t2);
35 string s1 = o1.ToString ();
36 string s2 = o2.ToString ();
38 if (s1 == s2) {
39 Console.Error.WriteLine ("expected string s1 {0} and s2 {1} to be different", s1, s2);
40 return 3;
43 return 0;