示例#1
0
        public void RemoveTailTest()
        {
            //also a test of the DisplayList method
            linkedList.AddTail('a'); //head
            linkedList.AddTail('b');
            linkedList.AddTail('c');
            linkedList.AddTail('d'); //tail
            int  preSize      = linkedList.Size;
            char removedValue = linkedList.RemoveTail();
            int  postSize     = linkedList.Size;

            //prints backwards
            Assert.AreEqual('d', removedValue);
            Assert.AreEqual("a b c ", linkedList.DisplayList());
            Assert.AreEqual(preSize, (postSize + 1));
        }
示例#2
0
        public void RemoveTailTest()
        {
            //also a test of the DisplayList method
            //head
            studentList.AddTail(studentA);
            studentList.AddTail(studentB);
            studentList.AddTail(studentC);
            studentList.AddTail(studentD);
            //tail
            int     preSize      = studentList.Size;
            Student removedValue = studentList.RemoveTail();
            int     postSize     = studentList.Size;

            //prints backwards
            Assert.AreEqual(studentD, removedValue);
            Assert.AreEqual("Sally Jerry Brian ", studentList.DisplayList());
            Assert.AreEqual(preSize, (postSize + 1));
        }