public void Execute_Processes_JobTable() { using (var connection = ConnectionUtils.CreateConnection()) { // Arrange const string createSql = @" insert into ""hangfire"".""job"" (""invocationdata"", ""arguments"", ""createdat"", ""expireat"") values ('', '', now() at time zone 'utc', @expireAt)"; connection.Execute(createSql, new { expireAt = DateTime.UtcNow.AddMonths(-1) }); var manager = CreateManager(); // Act manager.Execute(_token); // Assert Assert.Equal(0, connection.Query <long>(@"select count(*) from ""hangfire"".""job""").Single()); } }
public void Execute_Processes_CounterTable() { using (var connection = ConnectionUtils.CreateConnection()) { // Arrange const string createSql = @" insert into ""hangfire"".""counter"" (""key"", ""value"", ""expireat"") values ('key', 1, @expireAt)"; connection.Execute(createSql, new { expireAt = DateTime.UtcNow.AddMonths(-1) }); var manager = CreateManager(); // Act manager.Execute(_token); // Assert Assert.Equal(0, connection.Query <long>(@"select count(*) from ""hangfire"".""counter""").Single()); } }
private NpgsqlConnection CreateConnection() { return(ConnectionUtils.CreateConnection()); }