public void KnowsHowBigAQueueIs() { Assert.That(Resque.size("people"), Is.EqualTo(3)); Assert.That("chris", Is.EqualTo(((Dictionary <string, object>)Resque.Pop("people"))["name"])); Assert.That(Resque.size("people"), Is.EqualTo(2)); Resque.Pop("people"); Resque.Pop("people"); Assert.That(Resque.size("people"), Is.EqualTo(0)); }
public void CanPutJobsOnTheQueueByAskingWhichQueueTheyAreInterestedIn() { Assert.That(0, Is.EqualTo(Resque.size("tester"))); Assert.IsTrue(Resque.enqueue("resque.DummyJob", 20, "/tmp")); Assert.IsTrue(Resque.enqueue("resque.DummyJob", 20, "/tmp")); Job job = Resque.Reserve("tester"); Assert.That(20, Is.EqualTo(job.args()[0])); Assert.That("/tmp", Is.EqualTo(job.args()[1])); }
public void CanWorkOnMultipleQueues() { Job.create("high", "resque.GoodJob"); Job.create("critical", "resque.GoodJob"); worker = new Worker(new string[] { "critical", "high" }); worker.process(); Assert.AreEqual(Resque.size("high"), 1); Assert.AreEqual(Resque.size("critical"), 0); worker.process(); Assert.AreEqual(Resque.size("high"), 0); }
public void CanWorkOnAllQueues() { Job.create("high", "resque.GoodJob"); Job.create("critical", "resque.GoodJob"); Job.create("blahblah", "resque.GoodJob"); worker = new Worker("*"); worker.work(0); Console.WriteLine(Resque.size("high")); Console.WriteLine(Resque.size("critical")); Console.WriteLine(Resque.size("blahblah")); Assert.AreEqual(Resque.size("high"), 0); Assert.AreEqual(Resque.size("critical"), 0); Assert.AreEqual(Resque.size("blahblah"), 0); }
public void CanAskResqueForQueueSize() { Assert.That(0, Is.EqualTo(Resque.size("a_queue"))); Job.create("a_queue", "resque.DummyJob", 1, "asdf"); Assert.That(1, Is.EqualTo(Resque.size("a_queue"))); }
public void CanPeekAtAQueue() { Assert.That("chris", Is.EqualTo(((Dictionary <string, object>)Resque.Peek("people"))["name"])); Assert.That(Resque.size("people"), Is.EqualTo(3)); }