public void Ctor_CorrectlySets_AllInstanceProperties() { var fetchedJob = new SqlServerFetchedJob(_storage.Object, _connection.Object, _transaction.Object, JobId, Queue); Assert.Equal(JobId, fetchedJob.JobId); Assert.Equal(Queue, fetchedJob.Queue); }
public void Ctor_CorrectlySets_AllInstanceProperties() { var fetchedJob = new SqlServerFetchedJob(_storage.Object, _connection.Object, _transaction.Object, JobId, Queue); Assert.Equal(JobId, fetchedJob.JobId); Assert.Equal(Queue, fetchedJob.Queue); }
public void RemoveFromQueue_ReallyDeletesTheJobFromTheQueue() { UseConnection(sql => { // Arrange var id = CreateJobQueueRecord(sql, "1", "default"); var processingJob = new SqlServerFetchedJob(sql, id, "1", "default"); // Act processingJob.RemoveFromQueue(); // Assert var count = sql.Query<int>("select count(*) from HangFire.JobQueue").Single(); Assert.Equal(0, count); }); }
public void Requeue_SetsFetchedAtValueToNull() { UseConnection(sql => { // Arrange var id = CreateJobQueueRecord(sql, "1", "default"); var processingJob = new SqlServerFetchedJob(sql, id, "1", "default"); // Act processingJob.Requeue(); // Assert var record = sql.Query("select * from HangFire.JobQueue").Single(); Assert.Null(record.FetchedAt); }); }
public void RemoveFromQueue_ReallyDeletesTheJobFromTheQueue() { UseConnection(sql => { // Arrange var id = CreateJobQueueRecord(sql, "1", "default"); var processingJob = new SqlServerFetchedJob(sql, id, "1", "default"); // Act processingJob.RemoveFromQueue(); // Assert var count = sql.Query <int>("select count(*) from HangFire.JobQueue").Single(); Assert.Equal(0, count); }); }
public void RemoveFromQueue_DoesNotDelete_UnrelatedJobs() { UseConnection(sql => { // Arrange CreateJobQueueRecord(sql, "1", "default"); CreateJobQueueRecord(sql, "1", "critical"); CreateJobQueueRecord(sql, "2", "default"); var fetchedJob = new SqlServerFetchedJob(sql, 999, "1", "default"); // Act fetchedJob.RemoveFromQueue(); // Assert var count = sql.Query <int>("select count(*) from HangFire.JobQueue").Single(); Assert.Equal(3, count); }); }
public void Requeue_SetsFetchedAtValueToNull() { UseConnection(sql => { // Arrange var id = CreateJobQueueRecord(sql, "1", "default"); var processingJob = new SqlServerFetchedJob(sql, id, "1", "default"); // Act processingJob.Requeue(); // Assert var record = sql.Query("select * from HangFire.JobQueue").Single(); Assert.Null(record.FetchedAt); }); }
public void RemoveFromQueue_DoesNotDelete_UnrelatedJobs() { UseConnection(sql => { // Arrange CreateJobQueueRecord(sql, "1", "default"); CreateJobQueueRecord(sql, "1", "critical"); CreateJobQueueRecord(sql, "2", "default"); var fetchedJob = new SqlServerFetchedJob(sql, 999, "1", "default"); // Act fetchedJob.RemoveFromQueue(); // Assert var count = sql.Query<int>("select count(*) from HangFire.JobQueue").Single(); Assert.Equal(3, count); }); }