public void AddToEndTest()
 {
     GenericLinkedList<int> list = new GenericLinkedList<int>();
     list.AddToEnd(1);
     list.AddToEnd(2);
     string result = list.ToString();
     Assert.AreNotEqual(string.Empty, result);
     Assert.AreEqual("1, 2", result);
 }
示例#2
0
        public void AddToEndTest()
        {
            GenericLinkedList <int> list = new GenericLinkedList <int>();

            list.AddToEnd(1);
            list.AddToEnd(2);
            string result = list.ToString();

            Assert.AreNotEqual(string.Empty, result);
            Assert.AreEqual("1, 2", result);
        }
        public void ReadAtTest()
        {
            GenericLinkedList<int> list = new GenericLinkedList<int>();
            list.AddToEnd(1);
            list.AddToEnd(2);
            list.AddToEnd(3);
            string output = list.ToString();
            Assert.AreNotEqual(string.Empty, output);
            Assert.AreEqual("1, 2, 3", output);

            int result = list.ReadAt(2);
            Assert.AreEqual(2, result);
        }
示例#4
0
        public void ReadAtTest()
        {
            GenericLinkedList <int> list = new GenericLinkedList <int>();

            list.AddToEnd(1);
            list.AddToEnd(2);
            list.AddToEnd(3);
            string output = list.ToString();

            Assert.AreNotEqual(string.Empty, output);
            Assert.AreEqual("1, 2, 3", output);

            int result = list.ReadAt(2);

            Assert.AreEqual(2, result);
        }
示例#5
0
        public void RemoveAtFirstWhenThereIsOneNodeTest()
        {
            GenericLinkedList <int> list = new GenericLinkedList <int>();

            list.AddToEnd(1);
            string result = list.ToString();

            Assert.AreNotEqual(string.Empty, result);
            Assert.AreEqual("1", result);

            list.RemoveAt(1);

            result = list.ToString();
            Assert.AreEqual(string.Empty, result);
        }
示例#6
0
 public void Push(T item)
 {
     list.AddToEnd(item);
 }
        public void RemoveAtFirstWhenThereIsOneNodeTest()
        {
            GenericLinkedList<int> list = new GenericLinkedList<int>();
            list.AddToEnd(1);
            string result = list.ToString();
            Assert.AreNotEqual(string.Empty, result);
            Assert.AreEqual("1", result);

            list.RemoveAt(1);

            result = list.ToString();
            Assert.AreEqual(string.Empty, result);
        }