public void InsertKeyTest() { //also a test of the DisplayList method linkedList.AddHead('a'); //tail linkedList.AddHead('b'); linkedList.AddHead('c'); linkedList.AddHead('d'); //head Assert.AreEqual(true, linkedList.FindKey('a')); //finds key Assert.AreEqual(true, linkedList.InsertKey('F')); //changes key Assert.AreEqual(true, linkedList.FindKey('F')); Assert.AreEqual(true, linkedList.InsertKey('E')); Assert.AreEqual(true, linkedList.FindKey('E')); Assert.AreEqual(false, linkedList.FindKey('G')); Assert.AreEqual(false, linkedList.InsertKey('G')); Assert.AreEqual("d c b E ", linkedList.DisplayList()); }
public void InsertKeyTest() { //also a test of the DisplayList method studentList.AddHead(studentA); //tail studentList.AddHead(studentB); studentList.AddHead(studentA); studentList.AddHead(studentD); //head Assert.AreEqual(true, studentList.FindKey(studentA)); Assert.AreEqual(true, studentList.InsertKey(studentZ)); //inserts Z at A Assert.AreEqual(true, studentList.FindKey(studentZ)); Assert.AreEqual(true, studentList.InsertKey(studentE)); //inserts E at Z Assert.AreEqual(true, studentList.FindKey(studentE)); Assert.AreEqual(false, studentList.FindKey(studentF)); //false insert Assert.AreEqual(false, studentList.InsertKey(studentF)); Assert.AreEqual("Terry Bob Jerry Sally ", studentList.DisplayList()); //from head to tail: //studentD, studentE, studentB, studentA }