public void TestMethod28()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);

            // Swap 1 and 2
            SinglyLinkedListOps.Swap(ref head, head, head.next);
            ValidateList(head, new List <int> {
                2, 1
            });
        }
        public void TestMethod32()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);
            head = SinglyLinkedListOps.AddTail(head, 3);

            // Try to swap nodes, where 'b' doesn't exist.
            SinglyLinkedListOps.Swap(ref head, head.next, new SNode {
                data = 20
            });
            ValidateList(head, new List <int> {
                1, 2, 3
            });
        }
        public void TestMethod26()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);
            head = SinglyLinkedListOps.AddTail(head, 3);
            head = SinglyLinkedListOps.AddTail(head, 4);
            head = SinglyLinkedListOps.AddTail(head, 5);

            // Swap 2 and 3
            SinglyLinkedListOps.Swap(ref head, head.next, head.next.next);
            ValidateList(head, new List <int> {
                1, 3, 2, 4, 5
            });
        }
        public void TestMethod30()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);
            head = SinglyLinkedListOps.AddTail(head, 3);

            // Try to swap nodes that don't exist.
            SinglyLinkedListOps.Swap(ref head, new SNode {
                data = 10
            }, new SNode {
                data = 20
            });
            ValidateList(head, new List <int> {
                1, 2, 3
            });
        }