public void Errors_raised_during_pending_write_will_be_thrown_on_flush()
        {
            var limitedSizeStream = new MemoryStream(new byte[4]);
            var queueStub = PersistentQueueWithMemoryStream(limitedSizeStream);

            using (var session = new PersistentQueueSession(queueStub, limitedSizeStream, 1024 * 1024))
            {
                session.Enqueue(new byte[64 * 1024 * 1024 + 1]);
                session.Flush();
            }
        }
 public void Errors_raised_during_pending_write_will_be_thrown_on_flush()
 {
     var limitedSizeStream = new MemoryStream(new byte[4]);
     var queueStub = MockRepository.GenerateStub<IPersistentQueueImpl>();
     queueStub.Stub(x => x.AcquireWriter(null, null, null))
         .IgnoreArguments()
         .WhenCalled(invocation => ((Func<Stream, long>)invocation.Arguments[1])(limitedSizeStream));
     using (var session = new PersistentQueueSession(queueStub, limitedSizeStream, 1024 * 1024))
     {
         session.Enqueue(new byte[64 * 1024 * 1024 + 1]);
         session.Flush();
     }
 }