public async Task ProcessDeadLetteredMessage_GivenMessageButAddingLogCausesException_LogsAnError()
        {
            // Arrange
            const string jobId = "job-id-1";

            Message message = new Message();

            message.UserProperties.Add("jobId", jobId);

            IJobManagement jobManagement = CreateJobManagement();

            jobManagement
            .When(x => x.AddJobLog(Arg.Is(jobId), Arg.Any <JobLogUpdateModel>()))
            .Do(x => { throw new Exception(); });

            ILogger logger = CreateLogger();

            IDeadletterService service = CreateJobHelperService(jobManagement, logger);

            // Act
            await service.Process(message);

            // Assert
            logger
            .Received(1)
            .Error(Arg.Any <Exception>(), Arg.Is($"Failed to add a job log for job id '{jobId}'"));
        }