public void CouldRandomlyAddRemoveLast()
        {
            var map   = new SortedChunkedMap <int, int>(50);
            var list  = new List <int>();
            var count = 10000;

            for (int i = 0; i < count; i++)
            {
                list.Add(i);
            }
            Shuffle(list);
            for (int i = 0; i < count; i++)
            {
                map.Add(list[i], list[i]);
                Assert.AreEqual(i + 1, map.Version);
            }

            for (int i = 0; i < count; i++)
            {
                KeyValuePair <int, int> tmp;
                Assert.True(map.RemoveLast(out tmp));
                Assert.AreEqual(i + count + 1, map.Version);
            }
            Assert.True(map.IsEmpty);
        }
        public void RemoveFirstLastIncrementsVersion()
        {
            var map = new SortedChunkedMap <long, long>();

            map.Add(1, 1);
            Assert.AreEqual(1, map.Version);
            map.Add(2, 2);
            Assert.AreEqual(2, map.Version);
            KeyValuePair <long, long> tmp;

            map.RemoveFirst(out tmp);
            Assert.AreEqual(3, map.Version);
            map.RemoveLast(out tmp);
            Assert.AreEqual(4, map.Version);
        }