public MailingNotificationTests() { CurrentTenant = ServiceProvider.GetRequiredService <ICurrentTenant>(); NotificationRepository = ServiceProvider.GetRequiredService <INotificationRepository>(); NotificationInfoRepository = ServiceProvider.GetRequiredService <INotificationInfoRepository>(); EmailNotificationSendingJob = ServiceProvider.GetRequiredService <IAsyncBackgroundJob <EmailNotificationSendingJobArgs> >(); }
public SmsNotificationTests() { JsonSerializer = ServiceProvider.GetRequiredService <IJsonSerializer>(); NotificationRepository = ServiceProvider.GetRequiredService <INotificationRepository>(); NotificationInfoRepository = ServiceProvider.GetRequiredService <INotificationInfoRepository>(); SmsNotificationSendingJob = ServiceProvider.GetRequiredService <IAsyncBackgroundJob <SmsNotificationSendingJobArgs> >(); }
private async Task Launch(IAsyncBackgroundJob job, CancellationToken token = default) { var jobId = job.Id; LogJobStarted(jobId); try { var result = await job.ExecuteAsync(token); LogJobResult(jobId, result); } catch (Exception e) { _logger.Error(e, "Error during execution of job {jobId}", jobId); throw; } }