public void TestPartReplaced() { _exprTree = MakeEqualsNode(); _alias = "IntPrimitive"; _resultingTree = ColumnNamedNodeSwapper.Swap(_exprTree, _alias, _fullExpr); Assert.IsTrue(_resultingTree == _exprTree); ExprNode[] childNodes = _resultingTree.ChildNodes; ExprNode[] 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); }
public void TestWholeReplaced() { _exprTree = new ExprIdentNodeImpl("swapped"); _alias = "swapped"; _resultingTree = ColumnNamedNodeSwapper.Swap(_exprTree, _alias, _fullExpr); Assert.IsTrue(_resultingTree == _fullExpr); }