public void TestWithUntypedDerivedAndTMinimalWithFullSignature()
        {
            Base a = TypesafeActivator.CreateInstance <Base> (typeof(Derived), BindingFlags.Public | BindingFlags.Instance, null, CallingConventions.Any, null).With();

            Assert.That(a, Is.Not.Null);
            Assert.That(a.GetType(), Is.EqualTo(typeof(Derived)));
        }
        public void TestWithUntypedANull()
        {
            Base      a          = null;
            TestClass testObject = (TestClass)TypesafeActivator.CreateInstance(typeof(TestClass)).With(a);

            Assert.That(testObject.InvocationType, Is.EqualTo(typeof(Base)));
        }
        public void TestWithUntypedDerivedAndTMinimalWithBindingFlags()
        {
            Base a = TypesafeActivator.CreateInstance <Base> (typeof(Derived), BindingFlags.Public | BindingFlags.Instance).With();

            Assert.That(a, Is.Not.Null);
            Assert.That(a.GetType(), Is.EqualTo(typeof(Derived)));
        }
        public void TestWithCNull()
        {
            DerivedDerived c          = null;
            TestClass      testObject = TypesafeActivator.CreateInstance <TestClass> ().With(c);

            Assert.That(testObject.InvocationType, Is.EqualTo(typeof(Derived)));
        }
        public void TestWithObjectNull()
        {
            object    o          = null;
            TestClass testObject = TypesafeActivator.CreateInstance <TestClass> ().With(o);

            Assert.That(testObject.InvocationType, Is.EqualTo(typeof(object)));
        }
        public void TestValueTypeCustomCtor()
        {
            Struct @struct = TypesafeActivator.CreateInstance <Struct> ().With(1);

            Assert.That(1, Is.EqualTo(@struct.Value));
        }
        public void TestValueTypeDefaultCtor()
        {
            Struct @struct = TypesafeActivator.CreateInstance <Struct>().With();

            Assert.That(0, Is.EqualTo(@struct.Value));
        }
 public void TestWithUntypedAndTMinimalThrowsOnIncompatibleTypes()
 {
     TypesafeActivator.CreateInstance <Derived> (typeof(Base)).With();
 }