public void CanInstantiateClassWithDefaultConstructor() { var activator = new DynamicDelegateActivator(typeof(Test), Test.DefaultConstructorInfo); var instance = activator.CreateInstance(null); Assert.IsNotNull(instance); Assert.IsInstanceOf<Test>(instance); }
public DynamicDelegateContainerActivator( Type type, ConstructorInfo constructor, ArgumentCollection constructorArguments) { _constructor = constructor; _constructorArguments = constructorArguments; _activator = new DynamicDelegateActivator(type, constructor); }
public void CanInstantiateNonDefaultConstructor() { var activator = new DynamicDelegateActivator(typeof(Test), Test.OtherConstructorInfo); var instance = activator.CreateInstance(new object[] { "name", Int32.MaxValue }) as Test; Assert.IsNotNull(instance); Assert.AreEqual("name", instance.Arg1); Assert.AreEqual(Int32.MaxValue, instance.Arg2); }