Example #1
0
        public void CanCreatePublicInstance()
        {
            ConstructorNode   ctorNode = new ConstructorNode(typeof(PublicTestClass));
            StringLiteralNode sNode    = new StringLiteralNode("theValue");

            ctorNode.AddArgument(sNode);

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

            Assert.AreEqual(sNode.Text, instance._s);
            Assert.AreEqual(-1, instance._i);
        }
Example #2
0
        public void IsImmutable_object_PublicTestClass()
        {
            //Arrange
            var    validator = new ImmutableValidator();
            object target    = new PublicTestClass();

            //Act
            var actual = validator.IsImmutable(target);

            //Assert
            Assert.True(actual);
        }
Example #3
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);
        }