Ejemplo n.º 1
0
 private static TypedValue CreateWithoutParameters(RuntimeType runtimeType)
 {
     try {
         return(runtimeType.CreateInstance());
     }
     catch (Exception e) {
         throw new CreateException(runtimeType.Type, 0, e);
     }
 }
Ejemplo n.º 2
0
 static TypedValue CreateWithoutParameters(RuntimeType runtimeType)
 {
     try {
         return(runtimeType.CreateInstance());
     }
     catch (System.Exception e) {
         throw new CreateException(runtimeType.Type, 0, e.InnerException ?? e);
     }
 }
Ejemplo n.º 3
0
        public static void TestSet17_Method1()
        {
            //TestSet7
            var container = new Container();

            container.RegisterType <Type>();
            var typeActivator = new TypeActivator();
            var runtimeType   = new RuntimeType(typeActivator, new InjectionAttribute("Build.Tests.TestSet17.Type"), typeof(Type), true);

            runtimeType.SetRuntimeInstance(RuntimeInstance.CreateInstance);
            Assert.Throws <TypeInstantiationException>(() => runtimeType.CreateInstance(new object[] { "Build.Tests.TestSet17.Type" }));
        }
Ejemplo n.º 4
0
        public static void TestSet17_Method5()
        {
            //TestSet7
            var container = new Container();

            container.RegisterType <Type>();
            var typeActivator = new TypeActivator();
            var runtimeType   = new RuntimeType(typeActivator, new InjectionAttribute("Build.Tests.TestSet17.Type"), typeof(Type), true);

            runtimeType.SetRuntimeInstance(RuntimeInstance.CreateInstance);
            runtimeType.AddConstructorParameter(((TypeBuilder)container.Builder).CanRegister(runtimeType.ActivatorType), new RuntimeType(typeActivator, new InjectionAttribute(typeof(Type)), typeof(Type), true));
            Assert.Throws <TypeInstantiationException>(() => runtimeType.CreateInstance((string[])null));
        }