Algorithmix.UnitTest.NodeTest.IsEqual C# (CSharp) Метод

IsEqual() приватный статический Метод

private static IsEqual ( INode nodeA, INode nodeB ) : bool
nodeA INode
nodeB INode
Результат bool
        private static bool IsEqual(INode nodeA, INode nodeB)
        {
            if (nodeA.IsLeaf() ^ nodeB.IsLeaf())
            {
                throw new Exception("Identical nodes should be at the same height");
            }

            Assert.IsTrue(nodeA.LeftEdge().Direction == nodeB.LeftEdge().Direction);
            Assert.IsTrue(nodeA.RightEdge().Direction == nodeB.RightEdge().Direction);
            Assert.IsTrue(nodeA.LeftEdge().Orientation == nodeB.LeftEdge().Orientation);
            Assert.IsTrue(nodeA.RightEdge().Orientation == nodeB.RightEdge().Orientation);

            if (nodeA.IsLeaf() && nodeB.IsLeaf())
            {
                return true;
            }

            return IsEqual(nodeA.Left(), nodeB.Left()) && IsEqual(nodeA.Right(), nodeB.Right());
        }