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