public void Dispose_WithNoComplete_RequeuesAJob() { UseRedis(redis => { // Arrange redis.ListRightPush("hangfire:queue:my-queue:dequeued", "my-job"); var fetchedJob = new RedisFetchedJob(redis, "my-job", "my-queue"); // Act fetchedJob.Dispose(); // Assert Assert.Equal(1, redis.ListLength("hangfire:queue:my-queue")); }); }
public void Dispose_WithNoComplete_RequeuesAJob() { UseRedis(redis => { // Arrange redis.AddItemToList("hangfire:queue:my-queue:dequeued", "my-job"); var fetchedJob = new RedisFetchedJob(redis, "my-job", "my-queue"); // Act fetchedJob.Dispose(); // Assert Assert.Equal(1, redis.GetListCount("hangfire:queue:my-queue")); }); }
public void Dispose_WithNoComplete_RequeuesAJob() { UseRedis(redis => { // Arrange redis.RPush("{hangfire}:queue:my-queue:dequeued", "my-job"); var fetchedJob = new RedisFetchedJob(_storage, redis, "my-job", "my-queue"); // Act fetchedJob.Dispose(); // Assert Assert.Equal(1, redis.LLen("{hangfire}:queue:my-queue")); }); }
public void Dispose_AfterRemoveFromQueue_DoesNotRequeueAJob() { UseRedis(redis => { // Arrange redis.ListRightPush("hangfire:queue:my-queue:dequeued", "my-job"); redis.ListRightPush("hangfire:queue:my-queue:dequeued", "my-job"); var fetchedJob = new RedisFetchedJob(redis, "my-job", "my-queue"); // Act fetchedJob.RemoveFromQueue(); fetchedJob.Dispose(); // Assert Assert.Equal(0, redis.ListLength("hangfire:queue:my-queue")); }); }