public void TestProcessShortList() { SinglyLinkedList <int> shortList = new SinglyLinkedList <int>(); shortList.Add(1); shortList.Add(2); int value = ProcessList <int> .GetElementFromEndAt(shortList); }
public void TestProcessGetLastNumber() { SinglyLinkedList <int> largerList = new SinglyLinkedList <int>(); for (int i = 0; i <= 12; i++) { largerList.Add(i); } int value = ProcessList <int> .GetElementFromEndAt(largerList, 1); Assert.AreEqual(12, value); }
public void TestProcessLargeList() { SinglyLinkedList <int> largerList = new SinglyLinkedList <int>(); for (int i = 0; i < 33; i++) { largerList.Add(i); } int value = ProcessList <int> .GetElementFromEndAt(largerList); Assert.AreEqual(33 - 5, value); }
static void RunTypedDemo <T> (IEnumerable <T> dataList, int maxFromEnd) { Console.Write("A singly linked list of the following: "); Console.WriteLine(String.Join(",", dataList)); SinglyLinkedList <T> testData = new SinglyLinkedList <T>(); dataList.ToList().ForEach(x => testData.Add(x)); for (int position = 1; position <= maxFromEnd; position++) { Console.WriteLine(String.Format("Has this value {1} at position {0} from the end of the colleciton", position, ProcessList <T> .GetElementFromEndAt(testData, position))); } Console.ReadKey(); Console.WriteLine(); }
public void TestProcessEmptyList() { SinglyLinkedList <int> emptyList = new SinglyLinkedList <int>(); int value = ProcessList <int> .GetElementFromEndAt(emptyList); }