public void InsertLastTwoValues_Expect_CountEqualTwo()
        {
            var linkedList = new WsDoubleLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(3);

            Assert.Equal(2, linkedList.Count);
        }
        public void InsertLastTwoValues_Expect_LastReferencePrevious()
        {
            var linkedList = new WsDoubleLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(3);

            Assert.Equal(2, linkedList.Tail.Previous.Value);
        }
        public void InsertLastTwoValues_Expect_LastEqualTail_FirstEqualHead()
        {
            var linkedList = new WsDoubleLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(3);

            Assert.Equal(2, linkedList.Head.Value);
            Assert.Equal(3, linkedList.Tail.Value);
        }
        public void RemoveValue_Expect_CountDecreasesBy1()
        {
            int valueToBeRemoved = 3;
            var linkedList       = new WsDoubleLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(valueToBeRemoved);
            linkedList.Remove(valueToBeRemoved);

            Assert.Equal(1, linkedList.Count);
        }
        public void RemoveValue_Expect_ValueWasRemoved()
        {
            int valueToBeRemoved = 3;
            var linkedList       = new WsDoubleLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(valueToBeRemoved);
            linkedList.Remove(valueToBeRemoved);

            var exists = linkedList.ToArray().Any(x => x == valueToBeRemoved);

            Assert.False(exists);
        }
        public void LinkedListToArray_Expect_AllValuesIncluded()
        {
            var linkedList = new WsDoubleLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(3);
            linkedList.InsertFirst(6);

            var arr = linkedList.ToArray();

            Assert.Equal(6, arr[0]);
            Assert.Equal(2, arr[1]);
            Assert.Equal(3, arr[2]);
        }
        public void InsertLast_Expect_EqualTail()
        {
            var linkedList = new WsDoubleLinkedList();

            linkedList.InsertLast(2);

            Assert.NotNull(linkedList.Tail);
            Assert.Equal(2, linkedList.Tail.Value);
        }