diff --git a/src/Altinn.Notifications.Persistence/Repository/EmailNotificationRepository.cs b/src/Altinn.Notifications.Persistence/Repository/EmailNotificationRepository.cs index 32592636..410e9dcb 100644 --- a/src/Altinn.Notifications.Persistence/Repository/EmailNotificationRepository.cs +++ b/src/Altinn.Notifications.Persistence/Repository/EmailNotificationRepository.cs @@ -19,7 +19,7 @@ public class EmailNotificationRepository : IEmailNotificationRepository private readonly NpgsqlDataSource _dataSource; private const string _insertEmailNotificationSql = "call notifications.insertemailnotification($1, $2, $3, $4, $5, $6, $7)"; // (__orderid, _alternateid, _recipientid, _toaddress, _result, _resulttime, _expirytime) private const string _getEmailNotificationsSql = "select * from notifications.getemails_statusnew_updatestatus()"; - private const string _setResultStatus = "call notifications.updateemailstatus($1, $2, $3)"; // (_alternateid, _result, _operationid) + private const string _updateEmailStatus = "call notifications.updateemailstatus($1, $2, $3)"; // (_alternateid, _result, _operationid) private const string _getEmailRecipients = "select * from notifications.getemailrecipients($1)"; // (_alternateid) /// @@ -77,7 +77,7 @@ public async Task> GetNewNotifications() /// public async Task UpdateSendStatus(Guid notificationId, EmailNotificationResultType status, string? operationId = null) { - await using NpgsqlCommand pgcom = _dataSource.CreateCommand(_setResultStatus); + await using NpgsqlCommand pgcom = _dataSource.CreateCommand(_updateEmailStatus); pgcom.Parameters.AddWithValue(NpgsqlDbType.Uuid, notificationId); pgcom.Parameters.AddWithValue(NpgsqlDbType.Text, status.ToString()); pgcom.Parameters.AddWithValue(NpgsqlDbType.Text, operationId ?? (object)DBNull.Value); diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications.Integrations/TestingConsumers/EmailStatusConsumerTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications.Integrations/TestingConsumers/EmailStatusConsumerTests.cs index 877d1b95..ecc8c443 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications.Integrations/TestingConsumers/EmailStatusConsumerTests.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications.Integrations/TestingConsumers/EmailStatusConsumerTests.cs @@ -29,7 +29,7 @@ public async Task RunTask_ConfirmExpectedSideEffects() .GetServices(new List() { typeof(IHostedService) }, vars) .First(s => s.GetType() == typeof(EmailStatusConsumer))!; - _ = await PostgreUtil.PopulateDBWithOrderAndEmailNotification(_sendersRef); + (_, EmailNotification Notification) = await PostgreUtil.PopulateDBWithOrderAndEmailNotification(_sendersRef); SendOperationResult sendOperationResult = new() { diff --git a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailNotificationServiceTests.cs b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailNotificationServiceTests.cs index 02ed5142..1b38f3ac 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailNotificationServiceTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailNotificationServiceTests.cs @@ -137,7 +137,7 @@ public async Task CreateEmailNotification_ToAddressDefined_ResultFailedRecipient } [Fact] - public async Task UpdateSendStatus() + public async Task UpdateSendStatus_SendResultDefined_Succeded() { // Arrange Guid notificationid = Guid.NewGuid(); @@ -147,7 +147,7 @@ public async Task UpdateSendStatus() { NotificationId = notificationid, OperationId = operationId, - SendResult= EmailNotificationResultType.Succeeded + SendResult = EmailNotificationResultType.Succeeded }; var repoMock = new Mock(); @@ -157,8 +157,8 @@ public async Task UpdateSendStatus() // Act await service.UpdateSendStatus(sendOperationResult); - // Assert + // Assert repoMock.Verify(); }