Example #1
0
        public void ConstructorByDelegateWithType_WithCustomDelegate_NoParams()
        {
            var cd = DelegateFactory.Constructor <CustomCtr>();

            Assert.IsNotNull(cd);
            Assert.IsNotNull(cd());
            Assert.IsInstanceOfType(cd(), typeof(TestClass));
        }
Example #2
0
        public void ConstructorByDelegateWithType_NoParams()
        {
            var c = DelegateFactory.Constructor <Func <TestClass> >();

            Assert.IsNotNull(c);
            Assert.IsNotNull(c());
            Assert.IsInstanceOfType(c(), typeof(TestClass));
        }
Example #3
0
        public void ConstructorByDelegateWithType_IntParam_FromStruct()
        {
            var c = DelegateFactory.Constructor <Func <int, TestStruct> >();

            Assert.IsNotNull(c);
            var instance = c(0);

            Assert.IsInstanceOfType(instance, typeof(TestStruct));
        }
Example #4
0
        public void ConstructorByDelegateWithType_BoolParam()
        {
            var c = DelegateFactory.Constructor <Func <bool, TestClass> >();

            Assert.IsNotNull(c);
            var instance = c(false);

            Assert.IsNotNull(instance);
            Assert.IsInstanceOfType(instance, typeof(TestClass));
        }
Example #5
0
        public void ConstructorByDelegateWithType_WithCustomDelegate_SingleParam()
        {
            var cd = DelegateFactory.Constructor <CustomCtrSingleParam>();

            Assert.IsNotNull(cd);
            var instance = cd(0);

            Assert.IsNotNull(instance);
            Assert.IsInstanceOfType(instance, typeof(TestClass));
        }
Example #6
0
        public void ConstructorByDelegateWithType_NoCtor_IntParam()
        {
            var c = DelegateFactory.Constructor <Func <int, TestClassNoDefaultCtor> >();

            Assert.IsNull(c);
        }
Example #7
0
        public void ConstructorByDelegateWithType_NoCtor_BoolParam_FromStruct()
        {
            var c = DelegateFactory.Constructor <Func <bool, TestStruct> >();

            Assert.IsNull(c);
        }