public async Task ThenUpsertFeedback() { // Arrange _emailDetailsRepoMock .Setup(m => m.GetLatestFeedbackInviteSentDateAsync(FeedBackId)) .ReturnsAsync(new FeedbackInvite()); // Act await _sut.GenerateSurveyInvites(_message); // Assert _emailDetailsRepoMock.Verify(m => m.UpsertIntoFeedback(_message.UserRef, _message.AccountId, _message.Ukprn), Times.Once); }
public async Task Run( [ServiceBusTrigger("%GenerateSurveyInviteMessageQueueName%", Connection = "ServiceBusConnection")] string feedbackForCodeGeneration, ILogger log) { log.LogInformation($"Employer Survey Invite generator executed at: {DateTime.UtcNow}"); var message = JsonConvert.DeserializeObject <GenerateSurveyCodeMessage>(feedbackForCodeGeneration); try { await _surveyInviteGenerator.GenerateSurveyInvites(message); } catch (Exception ex) { log.LogError(ex, $"Failed to generate survey invite for Account: {message.AccountId}, Ukprn: {message.Ukprn}, User: {message.UserRef}"); throw; } log.LogInformation($"Employer Survey Invite generator completed at: {DateTime.UtcNow}"); }