public void EnqueueDequeue([CombinatorialValues(0, 1, 2, 3, 4, 5)] int dequeueCount) { var q = new SubscriberClientImpl.RequeueableQueue <string>(); q.Enqueue("a"); q.Enqueue(new[] { "b", "c" }); var dequeued = q.Dequeue(dequeueCount, null); var expected = new[] { "a", "b", "c" }.Take(dequeueCount); Assert.Equal(expected, dequeued); }
public void Count() { var q = new SubscriberClientImpl.RequeueableQueue <string>(); Assert.Equal(0, q.Count); q.Enqueue("a"); Assert.Equal(1, q.Count); q.Requeue(new[] { "b" }); Assert.Equal(2, q.Count); q.Requeue(new[] { "c", "d" }); Assert.Equal(4, q.Count); q.Dequeue(1, null); Assert.Equal(3, q.Count); q.Dequeue(2, null); Assert.Equal(1, q.Count); q.Enqueue("e"); q.Requeue(new[] { "f" }); Assert.Equal(3, q.Count); q.Dequeue(10, null); Assert.Equal(0, q.Count); }