public void GetDefinition()
 {
     Utilities.Reflection.Emit.Assembly     Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder  TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.FieldBuilder Field    = TestType.CreateField("Field1", typeof(int));
     Assert.NotEmpty(Field.GetDefinition());
 }
Пример #2
0
 public void GetDefinition()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
     Assert.NotEmpty(Field.GetDefinition());
 }
 public void GetDefinition()
 {
     Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.Interfaces.IPropertyBuilder Property = TestType.CreateDefaultProperty("Property1", typeof(int));
     Assert.NotEmpty(Property.GetDefinition());
 }
Пример #4
0
 public void CreateEnum()
 {
     Utilities.Reflection.Emit.Assembly TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis");
     Utilities.Reflection.Emit.EnumBuilder EnumObject = TestObject.CreateEnum("TestEnum");
     Assert.NotNull(EnumObject);
     TestObject.Create();
 }
Пример #5
0
 public void CreateType()
 {
     Utilities.Reflection.Emit.Assembly    TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis");
     Utilities.Reflection.Emit.TypeBuilder TypeObject = TestObject.CreateType("TestClass");
     Assert.NotNull(TypeObject);
     Assert.DoesNotThrow(() => TestObject.Create());
 }
Пример #6
0
 public void CreateType()
 {
     Utilities.Reflection.Emit.Assembly TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis");
     Utilities.Reflection.Emit.TypeBuilder TypeObject = TestObject.CreateType("TestClass");
     Assert.NotNull(TypeObject);
     TestObject.Create();
 }
 public void GetDefinition()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.Interfaces.IPropertyBuilder Property = TestType.CreateDefaultProperty("Property1", typeof(int));
     Assert.NotEmpty(Property.GetDefinition());
 }
Пример #8
0
 public void CreateEnum()
 {
     Utilities.Reflection.Emit.Assembly    TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis");
     Utilities.Reflection.Emit.EnumBuilder EnumObject = TestObject.CreateEnum("TestEnum");
     Assert.NotNull(EnumObject);
     Assert.DoesNotThrow(() => TestObject.Create());
 }
 public void Assign()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
     Assert.DoesNotThrow(() => Field.Assign(12));
 }
 public void Save()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     Local1.Save(Method.Generator);
 }
 public void Call()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     Assert.DoesNotThrow(() => Local1.Call("ToString"));
 }
Пример #12
0
 public void Create()
 {
     Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Assert.NotNull(TestType);
     Assert.DoesNotThrow(() => Assembly.Create());
     Assert.NotNull(Activator.CreateInstance(TestType.DefinedType));
 }
 public void Load()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     Assert.DoesNotThrow<Exception>(() => Local1.Load(Method.Generator));
 }
 public void MinusMinus()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateConstructor();
     Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
     --TestProperty;
 }
 public void PlusPlus()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateConstructor();
     Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
     Assert.DoesNotThrow(() => ++TestProperty);
 }
Пример #16
0
 public void Create()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Assert.NotNull(TestType);
     Assert.DoesNotThrow<Exception>(() => Assembly.Create());
     Assert.NotNull(Activator.CreateInstance(TestType.DefinedType));
 }
Пример #17
0
        public void Create()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");

            Assert.NotNull(Method);
        }
 public void Load()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     Field.Load(Method.Generator);
 }
Пример #19
0
 public void Call()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
     Assert.DoesNotThrow<Exception>(() => Field.Call("ToString"));
 }
Пример #20
0
        public void Assign()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");

            Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
            Assert.DoesNotThrow(() => Field.Assign(12));
        }
Пример #21
0
        public void PlusPlus()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateConstructor();

            Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
            ++TestProperty;
        }
Пример #22
0
        public void Call()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));

            Assert.DoesNotThrow <Exception>(() => Local1.Call("ToString"));
        }
Пример #23
0
 public void AddLiteral()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.EnumBuilder Enum = Assembly.CreateEnum("TestEnum");
     Enum.AddLiteral("TestLiteral1", 1);
     Enum.AddLiteral("TestLiteral2", 2);
     Assembly.Create();
     Assert.NotNull(Activator.CreateInstance(Enum.DefinedType));
 }
Пример #24
0
        public void Save()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));

            Local1.Save(Method.Generator);
        }
        public void Save()
        {
            Utilities.Reflection.Emit.Assembly     Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder  TestType = Assembly.CreateType("TestType");
            Utilities.Reflection.Emit.FieldBuilder Field    = TestType.CreateField("Field1", typeof(int));
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");

            Field.Save(Method.Generator);
        }
Пример #26
0
        public void Load()
        {
            Utilities.Reflection.Emit.Assembly     Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder  TestType = Assembly.CreateType("TestType");
            Utilities.Reflection.Emit.FieldBuilder Field    = TestType.CreateField("Field1", typeof(int));
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");

            Assert.DoesNotThrow <Exception>(() => Field.Load(Method.Generator));
        }
        public void Call()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");

            Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
            Field.Call("ToString");
        }
 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 Load()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));

            Assert.DoesNotThrow(() => Local1.Load(Method.Generator));
        }
Пример #30
0
 public void Box()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     VariableBase Local2 = Method.CreateLocal("Local2", typeof(int));
     Assert.NotNull(Method.Box(Local1));
 }
Пример #31
0
        public void MinusMinus()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateConstructor();

            Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
            Assert.DoesNotThrow(() => -- TestProperty);
        }
 public void Save()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateConstructor();
     Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
     Assert.Throws<NullReferenceException>(() => TestProperty.Save(null));
     Assert.DoesNotThrow(() => TestProperty.Save(Method.Generator));
 }
Пример #33
0
 public void AddLiteral()
 {
     Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.EnumBuilder Enum     = Assembly.CreateEnum("TestEnum");
     Enum.AddLiteral("TestLiteral1", 1);
     Enum.AddLiteral("TestLiteral2", 2);
     Assembly.Create();
     Assert.NotNull(Activator.CreateInstance(Enum.DefinedType));
 }
 public void Create()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     Assert.NotNull(Local1);
     Assert.Equal(typeof(int), Local1.DataType);
     Assert.Equal("Local1", Local1.Name);
 }
Пример #35
0
        public void NewObj()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2 = Method.CreateLocal("Local2", typeof(int));

            Assert.NotNull(Method.NewObj(typeof(DateTime), new object[] { Local1 }));
        }
Пример #36
0
        public void Box()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2 = Method.CreateLocal("Local2", typeof(int));

            Assert.NotNull(Method.Box(Local1));
        }
Пример #37
0
        public void Cast()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2 = Method.CreateLocal("Local2", typeof(int));

            Assert.DoesNotThrow(() => Method.Cast(Method.This, typeof(object)));
        }
        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 Load()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateConstructor();
     Assert.NotNull(Method.This);
     Assert.Null(Method.This.DataType);
     Assert.Equal("this", Method.This.Name);
     Method.This.Load(Method.Generator);
 }
Пример #40
0
 public void Call()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     IMethodBuilder Method2 = TestType.CreateMethod("TestMethod2");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     VariableBase Local2 = Method.CreateLocal("Local2", typeof(int));
     Assert.DoesNotThrow<Exception>(() => Method.This.Call(Method2, null));
 }
Пример #41
0
        public void Throw()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2 = Method.CreateLocal("Local2", typeof(int));

            Method.Throw(Method.NewObj(typeof(Exception)));
        }
 public void Save()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateConstructor();
     Assert.NotNull(Method.This);
     Assert.Null(Method.This.DataType);
     Assert.Equal("this", Method.This.Name);
     Assert.DoesNotThrow<Exception>(() => Method.This.Save(Method.Generator));
 }
Пример #43
0
        public void Save()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateConstructor();

            Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
            Assert.Throws <NullReferenceException>(() => TestProperty.Save(null));
            Assert.DoesNotThrow(() => TestProperty.Save(Method.Generator));
        }
        public void Return()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod", ReturnType: typeof(int));
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2 = Method.CreateLocal("Local2", typeof(int));

            Assert.DoesNotThrow <Exception>(() => Method.Return(Local1));
        }
 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();
     Assert.NotNull(Constructor);
     Assert.Equal(MethodAttributes.Public, Constructor.Attributes);
     Assert.NotNull(Constructor.Generator);
     Assert.NotNull(Constructor.Parameters);
     Assert.Equal(1, Constructor.Parameters.Count);
 }
Пример #46
0
        public void Call()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method  = TestType.CreateMethod("TestMethod");
            IMethodBuilder Method2 = TestType.CreateMethod("TestMethod2");
            VariableBase   Local1  = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2  = Method.CreateLocal("Local2", typeof(int));

            Method.This.Call(Method2, null);
        }
Пример #47
0
 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.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
     Assert.NotNull(Field);
     Assert.Equal(typeof(int), Field.DataType);
     Assert.Equal("Field1", Field.Name);
     Assert.Equal(FieldAttributes.Public, Field.Attributes);
     Assert.NotNull(Field.Builder);
 }
Пример #48
0
        public void Create()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));

            Assert.NotNull(Local1);
            Assert.Equal(typeof(int), Local1.DataType);
            Assert.Equal("Local1", Local1.Name);
        }
        public void Load()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateConstructor();

            Assert.NotNull(Method.This);
            Assert.Null(Method.This.DataType);
            Assert.Equal("this", Method.This.Name);
            Assert.DoesNotThrow <Exception>(() => Method.This.Load(Method.Generator));
        }
Пример #50
0
        public void Save()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateConstructor();

            Assert.NotNull(Method.This);
            Assert.Null(Method.This.DataType);
            Assert.Equal("this", Method.This.Name);
            Method.This.Save(Method.Generator);
        }
 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);
 }
 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.FieldBuilder Field    = TestType.CreateField("Field1", typeof(int));
     Assert.NotNull(Field);
     Assert.Equal(typeof(int), Field.DataType);
     Assert.Equal("Field1", Field.Name);
     Assert.Equal(FieldAttributes.Public, Field.Attributes);
     Assert.NotNull(Field.Builder);
 }
Пример #53
0
        public void While()
        {
            Utilities.Reflection.Emit.Assembly    Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
            Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
            IMethodBuilder Method = TestType.CreateMethod("TestMethod");
            VariableBase   Local1 = Method.CreateLocal("Local1", typeof(int));
            VariableBase   Local2 = Method.CreateLocal("Local2", typeof(int));

            Utilities.Reflection.Emit.Commands.While While = Method.While(Local1, Utilities.Reflection.Emit.Enums.Comparison.Equal, Local2);
            Method.EndWhile(While);
            Assert.NotNull(While);
        }
Пример #54
0
 public void CreateConstructor()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder TestConstructor = TestType.CreateConstructor();
     Assert.NotNull(TestConstructor);
     Assert.Equal(MethodAttributes.Public, TestConstructor.Attributes);
     Assert.NotNull(TestConstructor.Generator);
     Assert.Null(TestConstructor.Name);
     Assert.Equal(1, TestConstructor.Parameters.Count);
     Assert.Null(TestConstructor.ReturnType);
     Assert.NotNull(TestConstructor.This);
 }
 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.IPropertyBuilder Property = TestType.CreateDefaultProperty("Property1", typeof(int));
     Assert.NotNull(Property);
     Assert.Equal(typeof(int), Property.DataType);
     Assert.Equal("Property1", Property.Name);
     Assert.Equal(PropertyAttributes.SpecialName, Property.Attributes);
     Assert.NotNull(Property.GetMethod);
     Assert.Equal(MethodAttributes.Public | MethodAttributes.Virtual, Property.GetMethodAttributes);
     Assert.NotNull(Property.SetMethod);
     Assert.Equal(MethodAttributes.Public | MethodAttributes.Virtual, Property.SetMethodAttributes);
     Assert.NotNull(Property.Builder);
 }
Пример #56
0
 public void TryCatch()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     VariableBase Local2 = Method.CreateLocal("Local2", typeof(int));
     Utilities.Reflection.Emit.Commands.Try Try = Method.Try();
     Utilities.Reflection.Emit.Commands.Catch Catch = Method.Catch(typeof(Exception));
     Method.EndTry();
     Assert.NotNull(Try);
     Assert.NotNull(Catch);
 }
Пример #57
0
 public void Create()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     Assert.NotNull(Method);
 }
Пример #58
0
 public void NewObj()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     VariableBase Local2 = Method.CreateLocal("Local2", typeof(int));
     Assert.NotNull(Method.NewObj(typeof(DateTime), new object[] { Local1 }));
 }
Пример #59
0
 public void While()
 {
     Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
     Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
     IMethodBuilder Method = TestType.CreateMethod("TestMethod");
     VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
     VariableBase Local2 = Method.CreateLocal("Local2", typeof(int));
     Utilities.Reflection.Emit.Commands.While While = Method.While(Local1, Utilities.Reflection.Emit.Enums.Comparison.Equal, Local2);
     Method.EndWhile(While);
     Assert.NotNull(While);
 }
Пример #60
0
 public void Create()
 {
     Utilities.Reflection.Emit.Assembly TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis");
     TestObject.Create();
 }