public void CanCreatePublicInstanceWithNonPublicConstructor()
        {
            ConstructorNode ctorNode = new ConstructorNode();
            ctorNode.Text=typeof(PublicTestClass).FullName;
            StringLiteralNode sNode = new StringLiteralNode();
            sNode.Text = "theValue2";
            ctorNode.addChild(sNode);
            IntLiteralNode iNode = new IntLiteralNode();
            iNode.Text="2";
            ctorNode.addChild(iNode);

            PublicTestClass instance = (PublicTestClass) ((IExpression)ctorNode).GetValue();
            Assert.AreEqual( sNode.Text, instance._s );
            Assert.AreEqual( 2, instance._i );
        }
示例#2
0
        public void CanCreateNonPublicInstanceWithNonPublicConstructor()
        {
            ConstructorNode ctorNode = new ConstructorNode();

            ctorNode.Text = typeof(PrivateTestClass).FullName;
            StringLiteralNode sNode = new StringLiteralNode();

            sNode.Text = "theValue3";
            ctorNode.addChild(sNode);
            IntLiteralNode iNode = new IntLiteralNode();

            iNode.Text = "3";
            ctorNode.addChild(iNode);

            PublicTestClass instance = (PublicTestClass)((IExpression)ctorNode).GetValue();

            Assert.AreEqual(sNode.Text, instance._s);
            Assert.AreEqual(3, instance._i);
        }