Ejemplo n.º 1
0
        public void TestDeleteMiddleNode()
        {
            // Arrange
            SLLNode head   = new SLLNode(1);
            SLLNode second = new SLLNode(2);
            SLLNode third  = new SLLNode(3);
            SLLNode fourth = new SLLNode(4);

            head.Next   = second;
            second.Next = third;
            third.Next  = fourth;

            // Act
            LinkedLists.DeleteMiddleNode(second);

            // Assert
            Assert.AreEqual(head.Next.Data, 3);
            Assert.AreEqual(second.Next.Data, 4);
            Assert.IsNull(third.Next);
        }