public async Task ReloadWithData(int firstDequeue, int secondDequeue, int indexItemsPerPage = 30, int dataPageSize = 32 * 10) { var config = new UnitTestQueueConfiguration { IndexItemsPerPage = indexItemsPerPage, DataPageSize = dataPageSize }; try { using (var q1 = new Persistent.Queue.PersistentQueue(config)) { q1.EnqueueManySized(10, 32); var result = await q1.DequeueAsync(1, firstDequeue); result.Commit(); } using (var q2 = new Persistent.Queue.PersistentQueue(config)) { q2.EnqueueManySized(10, 32); var result = await q2.DequeueAsync(1, secondDequeue); result.Commit(); q2.HasItems.ShouldBeFalse(); } } finally { Directory.Delete(config.QueuePath, true); } }
public static void Enqueue(this Persistent.Queue.PersistentQueue queue, int itemNo) { var s = Encoding.UTF8.GetBytes($"Message {itemNo}"); queue.Enqueue(s); }
public static void EnqueueManySized(this Persistent.Queue.PersistentQueue queue, int count, int byteSize) { Enumerable.Range(1, count) .ForEach(_ => queue.Enqueue(new byte[byteSize])); }
public static void EnqueueMany(this Persistent.Queue.PersistentQueue queue, int count, int start = 1) { Enumerable.Range(start, count) .ForEach(queue.Enqueue); }