コード例 #1
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());
 }
コード例 #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());
 }
コード例 #3
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.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();
 }
コード例 #7
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.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());
 }
コード例 #9
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));
 }
コード例 #10
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);
 }
コード例 #11
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(() => 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));
 }
コード例 #13
0
 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));
 }
コード例 #14
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));
     --TestProperty;
 }
コード例 #15
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));
     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);
        }
コード例 #18
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");
     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
ファイル: PropertyBuilder.cs プロジェクト: ewin66/VilinCode
        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);
        }
コード例 #25
0
        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));
        }
コード例 #27
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));
            Field.Call("ToString");
        }
コード例 #28
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.Interfaces.IMethodBuilder Constructor = TestType.CreateConstructor();
     VariableBase Constant = Constructor.CreateConstant(12);
     Assert.NotNull(Constant);
     Assert.Equal(typeof(int), Constant.DataType);
 }
コード例 #29
0
        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);
        }
コード例 #32
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));
 }
コード例 #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));
 }
コード例 #34
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);
 }
コード例 #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)));
        }
コード例 #38
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.Interfaces.IMethodBuilder Constructor = TestType.CreateConstructor();
            VariableBase Constant = Constructor.CreateConstant(12);

            Assert.NotNull(Constant);
            Assert.Equal(typeof(int), Constant.DataType);
        }
コード例 #39
0
 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
ファイル: MethodBuilder.cs プロジェクト: ewin66/VilinCode
        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)));
        }
コード例 #42
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);
     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));
        }
コード例 #44
0
        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));
        }
コード例 #45
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.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
ファイル: MethodBuilder.cs プロジェクト: ewin66/VilinCode
        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);
        }
コード例 #49
0
        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);
        }
コード例 #51
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.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);
 }
コード例 #52
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);
 }
コード例 #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);
 }
コード例 #55
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.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();
 }