public void HasCycle_False_When_List_Length_2()
        {
            var list = new SingleLinkedListAlgo <string>("The", "Quick");

            bool hasCycle = list.HasCycle();

            Assert.False(hasCycle);
        }
        public void HasCycle_False()
        {
            var linkList =
                new SingleLinkedListAlgo <string>("The", "Quick", "Brown", "fox", "jumps", "over", "the", "lazy", "dog");

            bool hasCycle = linkList.HasCycle();

            Assert.False(hasCycle);
        }
        public void HasCycle_True_When_List_Length_2()
        {
            var list = new SingleLinkedListAlgo <string>();

            var firstNode  = list.Insert(1, "The");
            var secondNode = list.Insert(2, "Quick");

            secondNode.Next = firstNode;

            bool hasCycle = list.HasCycle();

            Assert.True(hasCycle);
        }
        public void HasCycle_True()
        {
            var list = new SingleLinkedListAlgo <string>();

            // 初始化一个具有环的链表
            list.Insert(1, "The");
            list.Insert(2, "Quick");
            list.Insert(3, "Brown");
            var fourthNode = list.Insert(4, "fox");

            list.Insert(5, "jumps");
            list.Insert(6, "over");
            list.Insert(7, "the");
            list.Insert(8, "lazy");
            var last = list.Insert(9, "dog");

            last.Next = fourthNode;

            bool hasCycle = list.HasCycle();

            Assert.True(hasCycle);
        }