示例#1
0
        public void ConstructorWithRefString()
        {
            ConstructorInfo constructor = typeof(OutAndRefTestClass).GetConstructors().Single(c => c.GetParameters().Count() == 1);

            var creator = DynamicReflectionDelegateFactory.Instance.CreateParameterizedConstructor(constructor);

            object[]           args = new object[] { "Input" };
            OutAndRefTestClass o    = (OutAndRefTestClass)creator(args);

            Assert.IsNotNull(o);
            Assert.AreEqual("Input", o.Input);
        }
示例#2
0
        public void ConstructorWithRefStringAndOutBool()
        {
            ConstructorInfo constructor = TestReflectionUtils.GetConstructors(typeof(OutAndRefTestClass)).Single(c => c.GetParameters().Count() == 2);

            var creator = LateBoundReflectionDelegateFactory.Instance.CreateParameterizedConstructor(constructor);

            object[]           args = new object[] { "Input", null };
            OutAndRefTestClass o    = (OutAndRefTestClass)creator(args);

            Assert.IsNotNull(o);
            Assert.AreEqual("Input", o.Input);
        }