public void PeekTest() { using (var client = new BeanstalkdClient(BeanstalkdHost)) { Assert.AreEqual(TestTube, client.Use(TestTube)); Assert.AreEqual(TestTube, client.CurrentTube); Assert.AreEqual(2, client.Watch(TestTube)); Assert.True(client.Ignore("default")); Assert.Less(0, client.Put(new byte[] { 97 })); Assert.AreEqual(1, client.StatsTube(TestTube).CurrentJobsReady); var job = client.PeekReady(); Assert.NotNull(job); var jobId = job.JobId; Assert.AreEqual(ReserveStatus.Reserved, client.Reserve(out job)); Assert.AreEqual(jobId, job.JobId); Assert.Null(client.PeekReady()); Assert.True(client.Release(jobId, delay: 1)); Assert.NotNull(client.PeekDelayed()); Assert.AreEqual(jobId, client.PeekDelayed().JobId); Thread.Sleep(1500); Assert.AreEqual(ReserveStatus.Reserved, client.Reserve(out job)); Assert.True(client.Bury(jobId)); Assert.NotNull(client.PeekBuried()); Assert.AreEqual(jobId, client.PeekBuried().JobId); Assert.AreEqual(1, client.Kick(1)); Assert.NotNull(client.Peek(jobId)); Assert.AreEqual(ReserveStatus.Reserved, client.Reserve(out job)); Assert.True(client.Delete(job.JobId)); } }
public void BuryTest() { using (var client = new BeanstalkdClient(BeanstalkdHost)) { Assert.AreEqual(TestTube, client.Use(TestTube)); Assert.AreEqual(TestTube, client.CurrentTube); Assert.AreEqual(2, client.Watch(TestTube)); Assert.True(client.Ignore("default")); Assert.Less(0, client.Put(new byte[] { 97 })); Assert.AreEqual(1, client.StatsTube(TestTube).CurrentJobsReady); Job job; Assert.AreEqual(ReserveStatus.Reserved, client.Reserve(0, out job)); Assert.True(client.Bury(job.JobId)); Assert.AreEqual(JobStatus.Buried, client.StatsJob(job.JobId).Status); Assert.AreEqual(1, client.Kick(1)); Assert.AreEqual(JobStatus.Ready, client.StatsJob(job.JobId).Status); Assert.AreEqual(ReserveStatus.Reserved, client.Reserve(0, out job)); Assert.True(client.Delete(job.JobId)); } }