public void CircularBuffer_EnqueueAfterTrimExcess()
        {
            var buffer = new CircularBuffer<string>(10);
            buffer.EnqueueRange(new[] { "a", "b", "c" }, 0, 3);

            buffer.TrimExcess();
            buffer.Enqueue("z");

            CollectionAssert.AreEqual(new[] { "z", "b", "c" }, buffer.ToArray());
            Assert.AreEqual(3, buffer.Count);
            Assert.AreEqual(3, buffer.Capacity);
            Assert.AreEqual(0, buffer.Head);
            Assert.AreEqual(1, buffer.Tail);
            Assert.IsTrue(buffer.Contains("z"));
            Assert.IsFalse(buffer.Contains("a"));
        }
        public void CircularBuffer_IndexerGet()
        {
            var buffer = new CircularBuffer<int>(10);
            buffer.EnqueueRange(
                new[] { 12, 4, 9, 43, 0 },
                0, 5);

            Assert.AreEqual(12, buffer[0]);
            Assert.AreEqual(0, buffer[4]);

            buffer.TrimExcess();
            buffer.EnqueueRange(new[] { 99, 100 }, 0, 2);

            Assert.AreEqual(99, buffer[0]);
            Assert.AreEqual(9, buffer[2]);
        }