public void RotateLeft() { var A = new MockBinaryTreeNode <int, string>(50, "A"); var B = new MockBinaryTreeNode <int, string>(30, "B"); var C = new MockBinaryTreeNode <int, string>(20, "C"); var D = new MockBinaryTreeNode <int, string>(40, "D"); var E = new MockBinaryTreeNode <int, string>(35, "E"); var F = new MockBinaryTreeNode <int, string>(45, "F"); var G = new MockBinaryTreeNode <int, string>(47, "G"); A.Parent = null; A.LeftChild = B; A.RightChild = null; B.Parent = A; B.LeftChild = C; B.RightChild = D; C.Parent = B; C.LeftChild = null; C.RightChild = null; D.Parent = B; D.LeftChild = E; D.RightChild = F; E.Parent = D; E.LeftChild = null; E.RightChild = null; F.Parent = D; F.LeftChild = null; F.RightChild = G; G.Parent = F; G.LeftChild = null; G.RightChild = null; Assert.IsTrue(HasBinarySearchTreeOrderProperty <MockBinaryTreeNode <int, string>, int, string>(A)); var tree = new MockBinarySearchTreeBase <int, string>(); tree.RotateLeft(B); Assert.IsTrue(HasBinarySearchTreeOrderProperty <MockBinaryTreeNode <int, string>, int, string>(A)); Assert.IsTrue(A.Parent == null); Assert.IsTrue(A.LeftChild.Equals(D)); Assert.IsTrue(A.RightChild == null); Assert.IsTrue(B.Parent.Equals(D)); Assert.IsTrue(B.LeftChild.Equals(C)); Assert.IsTrue(B.RightChild.Equals(E)); Assert.IsTrue(C.Parent.Equals(B)); Assert.IsTrue(C.LeftChild == null); Assert.IsTrue(C.RightChild == null); Assert.IsTrue(D.Parent.Equals(A)); Assert.IsTrue(D.LeftChild.Equals(B)); Assert.IsTrue(D.RightChild.Equals(F)); Assert.IsTrue(E.Parent.Equals(B)); Assert.IsTrue(E.LeftChild == null); Assert.IsTrue(E.RightChild == null); Assert.IsTrue(F.Parent.Equals(D)); Assert.IsTrue(F.LeftChild == null); Assert.IsTrue(F.RightChild.Equals(G)); Assert.IsTrue(G.Parent.Equals(F)); Assert.IsTrue(G.LeftChild == null); Assert.IsTrue(G.RightChild == null); }