public void LinkedListSingleLinkReverse1TestEmptyListWithDefaults()
        {
            // List to reverse.
            LinkedListSingleLinkNode <int> toReverse = null;

            // Reverse the list.
            LinkedListSingleLinkReverse1Complete.Reverse(ref toReverse);

            // Do the compare.
            Assert.IsTrue(LinkedListSingleLinkNode <int> .Compare(toReverse, null));
        }
        public void LinkedListSingleLinkReverse1TestSingleElementWithDefaults()
        {
            // List to reverse.
            var toReverse = LinkedListSingleLinkNode <int> .CreateFromData(3);

            // Expected list.
            var expected = LinkedListSingleLinkNode <int> .CreateFromData(3);

            // Reverse the list.
            LinkedListSingleLinkReverse1Complete.Reverse(ref toReverse);

            // Do the compare.
            Assert.IsTrue(LinkedListSingleLinkNode <int> .Compare(toReverse, expected));
        }
        public void LinkedListSingleLinkReverse1TestMultipleElementsWithEndingNode()
        {
            // List to reverse.
            var toReverse = LinkedListSingleLinkNode <int> .CreateFromData(1, 2, 3, 4, 5);

            // Expected list.
            var expected = LinkedListSingleLinkNode <int> .CreateFromData(2, 1, 3, 4, 5);

            // Reverse the list.
            LinkedListSingleLinkReverse1Complete.Reverse(ref toReverse, endReverse: toReverse.Next);

            // Do the compare.
            Assert.IsTrue(LinkedListSingleLinkNode <int> .Compare(toReverse, expected));
        }
        public void LinkedListSingleLinkReverse1TestEndBeforeStartNode()
        {
            try
            {
                var toReverse = LinkedListSingleLinkNode <int> .CreateFromData(1, 2, 3);

                LinkedListSingleLinkReverse1Complete.Reverse(ref toReverse, toReverse.Next, toReverse);
            }
            catch (ArgumentException)
            {
                Assert.IsTrue(true);
                return;
            }
            Assert.Fail();
        }
        public void LinkedListSingleLinkReverse1TestInvalidEndNode()
        {
            try
            {
                var toReverse = LinkedListSingleLinkNode <int> .CreateFromData(1, 2, 3);

                LinkedListSingleLinkReverse1Complete.Reverse(ref toReverse, endReverse: new LinkedListSingleLinkNode <int>());
            }
            catch (ArgumentException)
            {
                Assert.IsTrue(true);
                return;
            }
            Assert.Fail();
        }