public void GetLoopStart_NonCircular_Test() { var head = new AlgorithmsPractice.Lists.LinkedListNode <int>(3); var result = LinkedListService.GetLoopStart(head); Assert.Null(result); }
public void GetLoopStart_Circular_Test() { var head = new AlgorithmsPractice.Lists.LinkedListNode <int>(3); var circularList = head; circularList.Next = new AlgorithmsPractice.Lists.LinkedListNode <int>(3); circularList = circularList.Next; var loopStart = new AlgorithmsPractice.Lists.LinkedListNode <int>(3); circularList.Next = loopStart; circularList = circularList.Next; circularList.Next = new AlgorithmsPractice.Lists.LinkedListNode <int>(3); circularList = circularList.Next; circularList.Next = loopStart; var result = LinkedListService.GetLoopStart(head); Assert.AreEqual(loopStart, result); }