public void TestConstructorArgs() { ConstructorInfo method = type.GetConstructor(new Type[] { typeof(int), typeof(object) }); var o = new object(); Assert.IsNotNull(method.FastCreate(1, o)); Assert.AreEqual(1, ((Test)method.FastCreate(1, 0)).PropertyInt); Assert.ReferenceEquals(o, ((Test)method.FastCreate(1, o)).PropertyObj); }
//[ExpectedException(typeof(MemberAccessException))] public void TestConstructorArg() { ConstructorInfo method = type.GetConstructor(new Type[] { typeof(int) }); Assert.IsNotNull(method.FastCreate(1)); Assert.AreEqual(1, ((Test)method.FastCreate(1)).PropertyInt); method = type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(object) }, null); var o = new object(); Assert.IsNotNull(method.FastCreate(o)); Assert.ReferenceEquals(o, ((Test)method.FastCreate(o)).PropertyObj); }
public void TestConstructor() { ConstructorInfo method = type.GetConstructor(Type.EmptyTypes); Assert.IsNotNull(method.FastCreate()); }