예제 #1
0
        public void TestTypeLoad1()
        {
            TypeResolutionService trs = new TypeResolutionService(Path.GetTempPath());
            Type t = trs.GetType("Kzu, Clarius");

            Assert.IsNull(t);
        }
예제 #2
0
        public void TestTypeLoad4()
        {
            AddTempFiles(2);

            using (StreamWriter sw = new StreamWriter((string)CodeFiles[0]))
            {
                sw.WriteLine(@"
namespace TestLoad1
{
	public class First
	{
		public void Hello()
		{
			System.Console.WriteLine(""Hello!"");
		}
	}
}");
            }

            Compile(0);

            using (StreamWriter sw = new StreamWriter((string)CodeFiles[1]))
            {
                sw.WriteLine(@"
namespace TestLoad2
{
	public class Second : TestLoad1.First
	{
	}
}");
            }

            Compile(1, (string)AsmFiles[0]);

            TypeResolutionService trs = new TypeResolutionService(Path.GetTempPath());
            Type t = trs.GetType("TestLoad2.Second, " +
                                 Path.GetFileNameWithoutExtension((string)AsmFiles[1]));

            Assert.IsNotNull(t);

            object second = Activator.CreateInstance(t);

            second.GetType().InvokeMember("Hello", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod,
                                          null, second, new object[0]);
        }
예제 #3
0
        public void TestTypeLoad3()
        {
            AddTempFiles(1);

            using (StreamWriter sw = new StreamWriter((string)CodeFiles[0]))
            {
                sw.WriteLine(@"
namespace TestLoad1
{
	public class First
	{
	}
}");
            }

            Compile(0);

            TypeResolutionService trs = new TypeResolutionService(Path.GetTempPath());
            Type t = trs.GetType("TestLoad1.First, " +
                                 Path.GetFileNameWithoutExtension((string)AsmFiles[0]));

            Assert.IsNotNull(t);
        }
예제 #4
0
 public void TestTypeLoad2()
 {
     TypeResolutionService trs = new TypeResolutionService(Path.GetTempPath());
     Type t = trs.GetType("Kzu, Clarius", true);
 }
예제 #5
0
 public void TestTypeLoad()
 {
     TypeResolutionService trs = new TypeResolutionService(Path.GetTempPath());
     Type t = trs.GetType(null);
 }
예제 #6
0
        public static Type GetDesignModeType([NotNull] string name, bool throwOnError)
        {
            ArgumentUtility.CheckNotNullOrEmpty("name", name);

            return(TypeResolutionService.GetType(ParseAbbreviatedTypeName(name), throwOnError));
        }
예제 #7
0
        public static Type GetType([NotNull] string name)
        {
            ArgumentUtility.CheckNotNullOrEmpty("name", name);

            return(TypeResolutionService.GetType(ParseAbbreviatedTypeName(name), false));
        }