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()); }
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(); }
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()); }
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 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")); }
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); }
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)); }
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); }
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")); }
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 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")); }
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 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); }
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)); }
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)); }
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)); }
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 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 })); }
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 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); }
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)); }
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)); }
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); }
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); }
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); }
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 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 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); }
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); }
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); }
public void Create() { Utilities.Reflection.Emit.Assembly TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis"); TestObject.Create(); }