public void write_too_large_data()
        {


            var sut = new PersistentCircularIndex(_tempFile, 36, 3);
            Action actual = () => sut.Enqueue("".PadLeft(37));

            actual.ShouldThrow<ArgumentOutOfRangeException>();
        }
        public void full_queue()
        {


            var sut = new PersistentCircularIndex(_tempFile, 36, 3);
            sut.Enqueue("1");
            sut.Enqueue("2");
            sut.Enqueue("3");
            Action actual = () => sut.Enqueue("4");

            actual.ShouldThrow<QueueFullException>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PersistentQueue{T}"/> class.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">dataDirectory</exception>
        public PersistentQueue(PersistentQueueConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _dataDirectory = Path.Combine(configuration.DataDirectory, configuration.QueueName);
            _serializer    = configuration.Serializer;
            CreateDirectoryIfNotExists();

            _indexFileName = Path.Combine(configuration.DataDirectory, configuration.QueueName + ".idx");
            _index         = new PersistentCircularIndex(_indexFileName, RecordSize, configuration.MaxCount);

            Encoding = Encoding.UTF8;
        }
        public void circulate()
        {


            var sut = new PersistentCircularIndex(_tempFile, 36, 3);
            sut.Enqueue("1");
            sut.Enqueue("2");
            sut.Enqueue("3");
            sut.Dequeue().Should().Be("1");
            sut.Enqueue("4");
            sut.Dequeue().Should().Be("2");
            sut.Dequeue().Should().Be("3");
            sut.Enqueue("5");
            sut.Enqueue("6");
            sut.Dequeue().Should().Be("4");
            sut.Dequeue().Should().Be("5");
            sut.Dequeue().Should().Be("6");
            sut.Dequeue().Should().BeNull();
            sut.Dequeue().Should().BeNull();
        }