mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 08:32:50 -05:00
PM-10564: Notification create push notification simplification.
NotificationStatus not needed.
This commit is contained in:
@ -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())));
|
||||
}
|
||||
|
||||
|
@ -14,22 +14,17 @@ namespace Bit.Core.Test.Services;
|
||||
public class MultiServicePushNotificationServiceTests
|
||||
{
|
||||
[Theory]
|
||||
[BitAutoData(false)]
|
||||
[BitAutoData(true)]
|
||||
[BitAutoData]
|
||||
[NotificationCustomize]
|
||||
[NotificationStatusCustomize]
|
||||
public async Task PushSyncNotificationCreateAsync_Notification_Sent(bool notificationStatusNull,
|
||||
SutProvider<MultiServicePushNotificationService> sutProvider, Notification notification,
|
||||
NotificationStatus notificationStatus)
|
||||
public async Task PushSyncNotificationCreateAsync_Notification_Sent(
|
||||
SutProvider<MultiServicePushNotificationService> sutProvider, Notification notification)
|
||||
{
|
||||
await sutProvider.Sut.PushSyncNotificationCreateAsync(notification,
|
||||
notificationStatusNull ? null : notificationStatus);
|
||||
await sutProvider.Sut.PushSyncNotificationCreateAsync(notification);
|
||||
|
||||
var expectedNotificationStatus = notificationStatusNull ? null : notificationStatus;
|
||||
await sutProvider.GetDependency<IEnumerable<IPushNotificationService>>()
|
||||
.First()
|
||||
.Received(1)
|
||||
.PushSyncNotificationCreateAsync(notification, expectedNotificationStatus);
|
||||
.PushSyncNotificationCreateAsync(notification);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
Reference in New Issue
Block a user