/// <summary> /// Test adding an item to an empty list /// </summary> static void TestAddEmptyLinkedList() { SortedLinkedList <string> list = new SortedLinkedList <string>(); list.Add("Foxtrot"); Console.Write("TestAddEmptyLinkedList: "); string listString = list.ToString(); if (listString.Equals("Foxtrot") && list.Count == 1) { Console.WriteLine("Passed"); } else { Console.WriteLine("FAILED!!! Expected: Foxtrot and 1 Actual: " + listString + " and " + list.Count); } }
/// <summary> /// Test adding an item to the back of the list /// </summary> static void TestAddBackOfLinkedList() { SortedLinkedList <string> list = new SortedLinkedList <string>(); list.Add("Delta"); list.Add("Echo"); Console.Write("TestAddBackOfLinkedList: "); string listString = list.ToString(); if (listString.Equals("Delta,Echo") && list.Count == 2) { Console.WriteLine("Passed"); } else { Console.WriteLine("FAILED!!! Expected: Delta,Echo and 2 Actual: " + listString + " and " + list.Count); } }
/// <summary> /// Test adding an item to the iterior of the list /// </summary> static void TestAddInteriorOfLinkedList() { SortedLinkedList <string> list = new SortedLinkedList <string>(); list.Add("Delta"); list.Add("Golf"); list.Add("Echo"); list.Add("Foxtrot"); Console.Write("TestAddInteriorOfLinkedList: "); string listString = list.ToString(); if (listString.Equals("Delta,Echo,Foxtrot,Golf") && list.Count == 4) { Console.WriteLine("Passed"); } else { Console.WriteLine("FAILED!!! Expected: Delta,Echo,Foxtrot,Golf and 4 Actual: " + listString + " and " + list.Count); } }