예제 #1
0
        public void write_too_large_data()
        {
            var    sut    = new PersistentCircularIndex(_tempFile, 36, 3);
            Action actual = () => sut.Enqueue("".PadLeft(37));

            actual.ShouldThrow <ArgumentOutOfRangeException>();
        }
예제 #2
0
        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>();
        }
예제 #3
0
        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();
        }