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); }
public void IsImmutable_object_PublicTestClass() { //Arrange var validator = new ImmutableValidator(); object target = new PublicTestClass(); //Act var actual = validator.IsImmutable(target); //Assert Assert.True(actual); }
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); }