/
loader.cs
46 lines (36 loc) · 948 Bytes
/
loader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// loader.cs:
//
// Tests for assembly loading
//
using System;
using System.Reflection;
using System.Reflection.Emit;
public class Tests {
public static int Main (string[] args)
{
return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_load_partial_name ()
{
if (Assembly.LoadWithPartialName ("mscorlib") == null)
return 1;
else
return 0;
}
public static int test_0_load_dynamic ()
{
// Check that dynamic assemblies are not loaded by Assembly.Load
AssemblyName an = new AssemblyName();
an.Name = "NOT.EXISTS";
AssemblyBuilder ab =
AppDomain.CurrentDomain.DefineDynamicAssembly(an,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder mb = ab.DefineDynamicModule("NOT.EXISTS");
Assembly b = Assembly.LoadWithPartialName ("NOT.EXISTS");
if (b == null)
return 0;
else
return 1;
}
}