private static TypedValue CreateWithoutParameters(RuntimeType runtimeType) { try { return(runtimeType.CreateInstance()); } catch (Exception e) { throw new CreateException(runtimeType.Type, 0, e); } }
static TypedValue CreateWithoutParameters(RuntimeType runtimeType) { try { return(runtimeType.CreateInstance()); } catch (System.Exception e) { throw new CreateException(runtimeType.Type, 0, e.InnerException ?? e); } }
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" })); }
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)); }