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 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; }
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 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.CreateConstructor(); Assert.NotNull(Constructor); Assert.Equal(MethodAttributes.Public, Constructor.Attributes); Assert.NotNull(Constructor.Generator); Assert.NotNull(Constructor.Parameters); Assert.Equal(1, Constructor.Parameters.Count); }
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 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)); }
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); }