Exemplo n.º 1
0
        public void CanRemoveATailNode()
        {
            var subject = new DoubleyLinkedList();

            var one = subject.Append(1);
            var two = subject.Append(2);

            Assert.That(subject.ToString(), Is.EqualTo("Index: 0, Value: 1\r\nIndex: 1, Value: 2\r\n"));

            subject.Remove(two);

            Assert.That(subject.ToString(), Is.EqualTo("Index: 0, Value: 1\r\n"));
        }
Exemplo n.º 2
0
        public void InsertsAtMiddle()
        {
            var subject = new DoubleyLinkedList();

            subject.Append(1);
            var two = subject.Append(2);

            subject.Append(3);

            subject.InsertAt(two, 10);

            Assert.That(subject.ToString(), Is.EqualTo("Index: 0, Value: 1\r\nIndex: 1, Value: 2\r\nIndex: 2, Value: 10\r\nIndex: 3, Value: 3\r\n"));
        }
Exemplo n.º 3
0
        public void AppendsNodeToList()
        {
            var subject = new DoubleyLinkedList();

            subject.Append(10);

            Assert.That(subject.ToString(), Is.EqualTo("Index: 0, Value: 10\r\n"));
        }