Ejemplo n.º 1
0
        public void ConstructorByDelegateWithType_WithCustomDelegate_NoParams()
        {
            var cd = DelegateFactory.Constructor <CustomCtr>();

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

            Assert.IsNotNull(c);
            Assert.IsNotNull(c());
            Assert.IsInstanceOfType(c(), typeof(TestClass));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 6
0
        public void ConstructorByDelegateWithType_NoCtor_IntParam()
        {
            var c = DelegateFactory.Constructor <Func <int, TestClassNoDefaultCtor> >();

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

            Assert.IsNull(c);
        }