public void Create()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            Utilities.Reflection.Emit.Interfaces.IMethodBuilder Constructor = TestType.CreateConstructor();
            VariableBase Constant = Constructor.CreateConstant(12);

            Assert.NotNull(Constant);
            Assert.Equal(typeof(int), Constant.DataType);
        }
 public void Create()
 {
     Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.Interfaces.IMethodBuilder Constructor = TestType.CreateDefaultConstructor();
     Assert.NotNull(Constructor);
     Assert.Equal(MethodAttributes.Public, Constructor.Attributes);
     Assert.Null(Constructor.Generator);
     Assert.NotNull(Constructor.Parameters);
     Assert.Equal(1, Constructor.Parameters.Count);
 }
Пример #3
0
 public void CreateMethod()
 {
     Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.Interfaces.IMethodBuilder TestMethod = TestType.CreateMethod("TestMethod");
     Assert.NotNull(TestMethod);
     Assert.Equal("TestMethod", TestMethod.Name);
     Assert.Equal(typeof(void), TestMethod.ReturnType);
     Assert.NotNull(TestMethod.Generator);
     Assert.NotNull(TestMethod.This);
     Assert.Equal(1, TestMethod.Parameters.Count);
     Assert.Equal(MethodAttributes.Public | MethodAttributes.Virtual, TestMethod.Attributes);
 }