private Element RemoveLast()
        {
            Node removedNode = _cacheList.RemoveEnd();

            _index.Remove(removedNode.ElementIndex);
            return(removedNode.Element);
        }
        public void RemoveEndTest()
        {
            LRUDoublyLinkedList dll = new LRUDoublyLinkedList();

            Assert.IsNull(dll.RemoveEnd());

            Node n0 = new Node(null, null, new Element(new byte[0]), 0);

            dll.Insert(n0);
            dll.RemoveEnd();
            Assert.IsNull(dll.Get(0));
            Assert.AreEqual(0, dll.Size);

            dll.Insert(n0);
            Node n1 = new Node(null, null, new Element(new byte[0]), 1);

            dll.Insert(n1);
            dll.RemoveEnd();

            Assert.AreEqual(dll.Get(0), n1);
            Assert.IsNull(dll.Get(1));
            Assert.AreEqual(1, dll.Size);
        }