public void TestWholeReplaced() { exprTree = new ExprIdentNodeImpl("swapped"); alias = "swapped"; resultingTree = ColumnNamedNodeSwapper.Swap(exprTree, alias, fullExpr); Assert.IsTrue(resultingTree == fullExpr); }
public void TestPartReplaced() { exprTree = MakeEqualsNode(); alias = "IntPrimitive"; resultingTree = ColumnNamedNodeSwapper.Swap(exprTree, alias, fullExpr); Assert.IsTrue(resultingTree == exprTree); var childNodes = resultingTree.ChildNodes; var oldChildNodes = exprTree.ChildNodes; Assert.IsTrue(childNodes.Length == 2); Assert.IsTrue(childNodes[0] == fullExpr); Assert.IsTrue(childNodes[1] == oldChildNodes[1]); exprTree = resultingTree; alias = "IntBoxed"; resultingTree = ColumnNamedNodeSwapper.Swap(exprTree, alias, fullExpr); childNodes = resultingTree.ChildNodes; Assert.IsTrue(childNodes.Length == 2); Assert.IsTrue(childNodes[0] == fullExpr); Assert.IsTrue(childNodes[1] == fullExpr); exprTree = resultingTree; ExprNode newFullExpr = new ExprIdentNodeImpl("new full expr"); alias = "full expression"; resultingTree = ColumnNamedNodeSwapper.Swap(exprTree, alias, newFullExpr); childNodes = resultingTree.ChildNodes; Assert.IsTrue(childNodes.Length == 2); Assert.IsTrue(childNodes[0] == newFullExpr); Assert.IsTrue(childNodes[1] == newFullExpr); }