public void CanInstantiateClassWithDefaultConstructor() { var activator = new DynamicDelegateActivator(typeof(Test), Test.DefaultConstructorInfo); var instance = activator.CreateInstance(null); Assert.IsNotNull(instance); Assert.IsInstanceOf<Test>(instance); }
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); }