1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

PM-10564: Notification create push notification simplification.

NotificationStatus not needed.
This commit is contained in:
Maciej Zieniuk
2024-11-21 22:43:14 +00:00
parent 01c814595e
commit 3885885d5f
12 changed files with 63 additions and 108 deletions

View File

@ -22,26 +22,22 @@ namespace Bit.Core.Test.Services;
public class AzureQueuePushNotificationServiceTests
{
[Theory]
[BitAutoData(false)]
[BitAutoData(true)]
[BitAutoData]
[NotificationCustomize]
[NotificationStatusCustomize]
[CurrentContextCustomize]
public async Task PushSyncNotificationCreateAsync_Notification_Sent(bool notificationStatusNull,
public async Task PushSyncNotificationCreateAsync_Notification_Sent(
SutProvider<AzureQueuePushNotificationService> sutProvider, Notification notification, Guid deviceIdentifier,
ICurrentContext currentContext, NotificationStatus notificationStatus)
ICurrentContext currentContext)
{
var expectedNotificationStatus = notificationStatusNull ? null : notificationStatus;
currentContext.DeviceIdentifier.Returns(deviceIdentifier.ToString());
sutProvider.GetDependency<IHttpContextAccessor>().HttpContext!.RequestServices
.GetService(Arg.Any<Type>()).Returns(currentContext);
await sutProvider.Sut.PushSyncNotificationCreateAsync(notification, expectedNotificationStatus);
await sutProvider.Sut.PushSyncNotificationCreateAsync(notification);
await sutProvider.GetDependency<QueueClient>().Received(1)
.SendMessageAsync(Arg.Is<string>(message =>
MatchMessage(PushType.SyncNotificationCreate, message,
new SyncNotificationEquals(notification, expectedNotificationStatus),
MatchMessage(PushType.SyncNotificationCreate, message, new SyncNotificationEquals(notification, null),
deviceIdentifier.ToString())));
}