public void SumTree_CorrectlyAddsUpTheValues() { var tip = new Tip(); var myTree = new Node(0, new Node(1, new Node(2, tip, tip), new Node(3, tip, tip)), new Node(4, tip, tip)); AreEqual(10, TreeUsingUnions.SumTree(new Union<Node, Tip>(myTree))); }
public Node(int value, Node left, Node right) { Value = value; Left = new Union<Node, Tip>(left); Right = new Union<Node, Tip>(right); }