public void TestMethod5()
 {
     ConstructorInfo barConstructorInfo = TypeHelper.GetConstructors(typeof(Bar)).First();
     ConstructorInfo fooConstructorInfo = TypeHelper.GetConstructors(typeof(Foo)).First();
     DynamicMethodSkeleton dynamicMethodSkeleton = new DynamicMethodSkeleton();
     var generator = dynamicMethodSkeleton.GetILGenerator();
     generator.Emit(OpCodes.Newobj, barConstructorInfo);
     generator.Emit(OpCodes.Newobj, fooConstructorInfo);
     var del = dynamicMethodSkeleton.CreateDelegate();
     var instance = del(new object[] { });
     Assert.IsNotNull(instance);
 }
Esempio n. 2
0
        public void TestMethod5()
        {
            ConstructorInfo       barConstructorInfo    = typeof(Bar).GetTypeInfo().DeclaredConstructors.First();
            ConstructorInfo       fooConstructorInfo    = typeof(FooWithDependency).GetTypeInfo().DeclaredConstructors.First();
            DynamicMethodSkeleton dynamicMethodSkeleton = new DynamicMethodSkeleton();
            var generator = dynamicMethodSkeleton.GetILGenerator();

            generator.Emit(OpCodes.Newobj, barConstructorInfo);
            generator.Emit(OpCodes.Newobj, fooConstructorInfo);
            var del      = dynamicMethodSkeleton.CreateDelegate();
            var instance = del(new object[] { });

            Assert.IsNotNull(instance);
        }
Esempio n. 3
0
        public void TestMethod5()
        {
            ConstructorInfo       barConstructorInfo    = TypeHelper.GetConstructors(typeof(Bar)).First();
            ConstructorInfo       fooConstructorInfo    = TypeHelper.GetConstructors(typeof(Foo)).First();
            DynamicMethodSkeleton dynamicMethodSkeleton = new DynamicMethodSkeleton();
            var generator = dynamicMethodSkeleton.GetILGenerator();

            generator.Emit(OpCodes.Newobj, barConstructorInfo);
            generator.Emit(OpCodes.Newobj, fooConstructorInfo);
            var del      = dynamicMethodSkeleton.CreateDelegate();
            var instance = del(new object[] { });

            Assert.IsNotNull(instance);
        }
 public void TestMethod5()
 {
     ConstructorInfo barConstructorInfo = typeof(Bar).GetTypeInfo().DeclaredConstructors.First();
     ConstructorInfo fooConstructorInfo = typeof(FooWithDependency).GetTypeInfo().DeclaredConstructors.First();
     DynamicMethodSkeleton dynamicMethodSkeleton = new DynamicMethodSkeleton();
     var generator = dynamicMethodSkeleton.GetILGenerator();
     generator.Emit(OpCodes.Newobj, barConstructorInfo);
     generator.Emit(OpCodes.Newobj, fooConstructorInfo);
     var del = dynamicMethodSkeleton.CreateDelegate();
     var instance = del(new object[] { });
     Assert.IsNotNull(instance);
 }