public void Should_return_correct_values_for_claim()
        {
            var blockingWaitStrategy = new BlockingWaitStrategy();
            var writer = new RingBufferWriter(5, blockingWaitStrategy);

            var first  = writer.Claim();
            var second = writer.Claim();

            Assert.That(first, Is.EqualTo(0));
            Assert.That(second, Is.EqualTo(1));
        }
        public void Should_return_correct_values_for_multiclaim()
        {
            var blockingWaitStrategy = new BlockingWaitStrategy();
            var writer = new RingBufferWriter(5, blockingWaitStrategy);

            var first = writer.Claim(3);
            var second = writer.Claim(4);

            Assert.That(first, Is.EqualTo(2));
            Assert.That(second, Is.EqualTo(6));
        }
        private void Write(int value)
        {
            long sequence = _committer.Claim();

            _buffer[sequence] = value;
            Console.WriteLine("+c: {0}", value);
            _committer.Commit(sequence, 1);
        }