Beispiel #1
0
        public void NodeEquality()
        {
            var left = new Node<int>(27);
            var right = new Node<int>(28);

            var n = new Node<int>(1);
            n.Left = left;
            n.Right = right;

            var equal = new Node<int>(1);
            equal.Left = left;
            equal.Right = right;

            var notEqualItem = new Node<int>(33);
            notEqualItem.Left = left;
            notEqualItem.Right = right;

            var notEqualNodes = new Node<int>(1);
            notEqualNodes.Left = right;
            notEqualNodes.Right = left;

            Assert.IsTrue(n.Equals(equal));
            Assert.IsFalse(n.Equals(notEqualItem));
            Assert.IsFalse(n.Equals(notEqualNodes));
        }