public void Can_delete_record()
 {
     AppendRecord(1, false);
     AppendRecord(2, false);
     var queueStream = new SingleFileQueueStream(_stream);
     var handle = queueStream.ReadNextRecord().Handle;
     queueStream.DeleteRecord(handle);
     AssertRecord(1, 0, true);
 }
 public void Deleting_last_record_truncates_file()
 {
     AppendRecord(1, false);
     AppendRecord(2, true);
     AppendRecord(3, false);
     var queueStream = new SingleFileQueueStream(_stream);
     var handle1 = queueStream.ReadNextRecord().Handle;
     var handle2 = queueStream.ReadNextRecord().Handle;
     queueStream.DeleteRecord(handle1);
     queueStream.DeleteRecord(handle2);
     Assert.AreEqual(0, _stream.Length);
 }
 public void Can_append_record_to_truncated_file()
 {
     AppendRecord(1, false);
     var queueStream = new SingleFileQueueStream(_stream);
     var handle = queueStream.ReadNextRecord().Handle;
     queueStream.DeleteRecord(handle);
     using(var stream = new MemoryStream()) {
         stream.Write(BitConverter.GetBytes(10));
         stream.Seek(0, SeekOrigin.Begin);
         queueStream.AppendRecord(stream, stream.Length);
         AssertRecord(10, 0, false);
         Assert.AreEqual(1, queueStream.UnreadCount);
     }
 }