diff --git a/src/Core/Models/PushNotification.cs b/src/Core/Models/PushNotification.cs index d6fac8b381..ad39a8686b 100644 --- a/src/Core/Models/PushNotification.cs +++ b/src/Core/Models/PushNotification.cs @@ -1,5 +1,6 @@ #nullable enable using Bit.Core.Enums; +using Bit.Core.NotificationCenter.Enums; namespace Bit.Core.Models; @@ -46,12 +47,17 @@ public class SyncSendPushNotification public DateTime RevisionDate { get; set; } } -public class SyncNotificationPushNotification +public class NotificationPushNotification { public Guid Id { get; set; } + public Priority Priority { get; set; } + public bool Global { get; set; } + public ClientType ClientType { get; set; } public Guid? UserId { get; set; } public Guid? OrganizationId { get; set; } - public ClientType ClientType { get; set; } + public string? Title { get; set; } + public string? Body { get; set; } + public DateTime CreationDate { get; set; } public DateTime RevisionDate { get; set; } public DateTime? ReadDate { get; set; } public DateTime? DeletedDate { get; set; } diff --git a/src/Core/NotificationCenter/Commands/CreateNotificationCommand.cs b/src/Core/NotificationCenter/Commands/CreateNotificationCommand.cs index 75faba0874..117083a1d0 100644 --- a/src/Core/NotificationCenter/Commands/CreateNotificationCommand.cs +++ b/src/Core/NotificationCenter/Commands/CreateNotificationCommand.cs @@ -37,7 +37,7 @@ public class CreateNotificationCommand : ICreateNotificationCommand var newNotification = await _notificationRepository.CreateAsync(notification); - await _pushNotificationService.PushSyncNotificationAsync(newNotification); + await _pushNotificationService.PushNotificationAsync(newNotification); return newNotification; } diff --git a/src/Core/NotificationCenter/Commands/CreateNotificationStatusCommand.cs b/src/Core/NotificationCenter/Commands/CreateNotificationStatusCommand.cs index b88d29552f..57af9ab6b8 100644 --- a/src/Core/NotificationCenter/Commands/CreateNotificationStatusCommand.cs +++ b/src/Core/NotificationCenter/Commands/CreateNotificationStatusCommand.cs @@ -48,7 +48,7 @@ public class CreateNotificationStatusCommand : ICreateNotificationStatusCommand var newNotificationStatus = await _notificationStatusRepository.CreateAsync(notificationStatus); - await _pushNotificationService.PushSyncNotificationStatusAsync(notification, newNotificationStatus); + await _pushNotificationService.PushNotificationStatusAsync(notification, newNotificationStatus); return newNotificationStatus; } diff --git a/src/Core/NotificationCenter/Commands/MarkNotificationDeletedCommand.cs b/src/Core/NotificationCenter/Commands/MarkNotificationDeletedCommand.cs index 70c4444bb8..455c03c5c5 100644 --- a/src/Core/NotificationCenter/Commands/MarkNotificationDeletedCommand.cs +++ b/src/Core/NotificationCenter/Commands/MarkNotificationDeletedCommand.cs @@ -65,7 +65,7 @@ public class MarkNotificationDeletedCommand : IMarkNotificationDeletedCommand var newNotificationStatus = await _notificationStatusRepository.CreateAsync(notificationStatus); - await _pushNotificationService.PushSyncNotificationStatusAsync(notification, newNotificationStatus); + await _pushNotificationService.PushNotificationStatusAsync(notification, newNotificationStatus); } else { @@ -76,7 +76,7 @@ public class MarkNotificationDeletedCommand : IMarkNotificationDeletedCommand await _notificationStatusRepository.UpdateAsync(notificationStatus); - await _pushNotificationService.PushSyncNotificationStatusAsync(notification, notificationStatus); + await _pushNotificationService.PushNotificationStatusAsync(notification, notificationStatus); } } } diff --git a/src/Core/NotificationCenter/Commands/MarkNotificationReadCommand.cs b/src/Core/NotificationCenter/Commands/MarkNotificationReadCommand.cs index 7068ca2c33..ca81e8b751 100644 --- a/src/Core/NotificationCenter/Commands/MarkNotificationReadCommand.cs +++ b/src/Core/NotificationCenter/Commands/MarkNotificationReadCommand.cs @@ -65,7 +65,7 @@ public class MarkNotificationReadCommand : IMarkNotificationReadCommand var newNotificationStatus = await _notificationStatusRepository.CreateAsync(notificationStatus); - await _pushNotificationService.PushSyncNotificationStatusAsync(notification, newNotificationStatus); + await _pushNotificationService.PushNotificationStatusAsync(notification, newNotificationStatus); } else { @@ -76,7 +76,7 @@ public class MarkNotificationReadCommand : IMarkNotificationReadCommand await _notificationStatusRepository.UpdateAsync(notificationStatus); - await _pushNotificationService.PushSyncNotificationStatusAsync(notification, notificationStatus); + await _pushNotificationService.PushNotificationStatusAsync(notification, notificationStatus); } } } diff --git a/src/Core/NotificationCenter/Commands/UpdateNotificationCommand.cs b/src/Core/NotificationCenter/Commands/UpdateNotificationCommand.cs index 0b0a2141c0..12d47cff0b 100644 --- a/src/Core/NotificationCenter/Commands/UpdateNotificationCommand.cs +++ b/src/Core/NotificationCenter/Commands/UpdateNotificationCommand.cs @@ -48,6 +48,6 @@ public class UpdateNotificationCommand : IUpdateNotificationCommand await _notificationRepository.ReplaceAsync(notification); - await _pushNotificationService.PushSyncNotificationAsync(notification); + await _pushNotificationService.PushNotificationAsync(notification); } } diff --git a/src/Core/NotificationCenter/Entities/Notification.cs b/src/Core/NotificationCenter/Entities/Notification.cs index 7ab3187524..a8b5c7d1fa 100644 --- a/src/Core/NotificationCenter/Entities/Notification.cs +++ b/src/Core/NotificationCenter/Entities/Notification.cs @@ -15,9 +15,8 @@ public class Notification : ITableObject public ClientType ClientType { get; set; } public Guid? UserId { get; set; } public Guid? OrganizationId { get; set; } - [MaxLength(256)] - public string? Title { get; set; } - public string? Body { get; set; } + [MaxLength(256)] public string? Title { get; set; } + [MaxLength(3000)] public string? Body { get; set; } public DateTime CreationDate { get; set; } public DateTime RevisionDate { get; set; } diff --git a/src/Core/NotificationHub/NotificationHubPushNotificationService.cs b/src/Core/NotificationHub/NotificationHubPushNotificationService.cs index 617a74363b..461a6da659 100644 --- a/src/Core/NotificationHub/NotificationHubPushNotificationService.cs +++ b/src/Core/NotificationHub/NotificationHubPushNotificationService.cs @@ -182,14 +182,19 @@ public class NotificationHubPushNotificationService : IPushNotificationService await PushAuthRequestAsync(authRequest, PushType.AuthRequestResponse); } - public async Task PushSyncNotificationAsync(Notification notification) + public async Task PushNotificationAsync(Notification notification) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate }; @@ -205,14 +210,19 @@ public class NotificationHubPushNotificationService : IPushNotificationService } } - public async Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) + public async Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate, ReadDate = notificationStatus.ReadDate, DeletedDate = notificationStatus.DeletedDate diff --git a/src/Core/Services/IPushNotificationService.cs b/src/Core/Services/IPushNotificationService.cs index 3659a69fe8..f749c851e3 100644 --- a/src/Core/Services/IPushNotificationService.cs +++ b/src/Core/Services/IPushNotificationService.cs @@ -24,8 +24,8 @@ public interface IPushNotificationService Task PushSyncSendCreateAsync(Send send); Task PushSyncSendUpdateAsync(Send send); Task PushSyncSendDeleteAsync(Send send); - Task PushSyncNotificationAsync(Notification notification); - Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus); + Task PushNotificationAsync(Notification notification); + Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus); Task PushAuthRequestAsync(AuthRequest authRequest); Task PushAuthRequestResponseAsync(AuthRequest authRequest); diff --git a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs index d041888fec..968c7933ad 100644 --- a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs +++ b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs @@ -165,28 +165,38 @@ public class AzureQueuePushNotificationService : IPushNotificationService await PushSendAsync(send, PushType.SyncSendDelete); } - public async Task PushSyncNotificationAsync(Notification notification) + public async Task PushNotificationAsync(Notification notification) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate }; await SendMessageAsync(PushType.SyncNotification, message, true); } - public async Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) + public async Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate, ReadDate = notificationStatus.ReadDate, DeletedDate = notificationStatus.DeletedDate diff --git a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs index 36e9197116..f7784afc53 100644 --- a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs +++ b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs @@ -146,15 +146,15 @@ public class MultiServicePushNotificationService : IPushNotificationService return Task.FromResult(0); } - public Task PushSyncNotificationAsync(Notification notification) + public Task PushNotificationAsync(Notification notification) { - PushToServices((s) => s.PushSyncNotificationAsync(notification)); + PushToServices((s) => s.PushNotificationAsync(notification)); return Task.CompletedTask; } - public Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) + public Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) { - PushToServices((s) => s.PushSyncNotificationStatusAsync(notification, notificationStatus)); + PushToServices((s) => s.PushNotificationStatusAsync(notification, notificationStatus)); return Task.CompletedTask; } diff --git a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs index 7edb5602b8..bad72a4dc3 100644 --- a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs @@ -172,28 +172,38 @@ public class NotificationsApiPushNotificationService : BaseIdentityClientService await PushSendAsync(send, PushType.SyncSendDelete); } - public async Task PushSyncNotificationAsync(Notification notification) + public async Task PushNotificationAsync(Notification notification) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate }; await SendMessageAsync(PushType.SyncNotification, message, true); } - public async Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) + public async Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate, ReadDate = notificationStatus.ReadDate, DeletedDate = notificationStatus.DeletedDate diff --git a/src/Core/Services/Implementations/RelayPushNotificationService.cs b/src/Core/Services/Implementations/RelayPushNotificationService.cs index 2aec38dca4..3a36faa188 100644 --- a/src/Core/Services/Implementations/RelayPushNotificationService.cs +++ b/src/Core/Services/Implementations/RelayPushNotificationService.cs @@ -190,14 +190,19 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti await SendPayloadToUserAsync(authRequest.UserId, type, message, true); } - public async Task PushSyncNotificationAsync(Notification notification) + public async Task PushNotificationAsync(Notification notification) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate }; @@ -213,14 +218,19 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti } } - public async Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) + public async Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) { - var message = new SyncNotificationPushNotification + var message = new NotificationPushNotification { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate, ReadDate = notificationStatus.ReadDate, DeletedDate = notificationStatus.DeletedDate diff --git a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs index 9f4994c5bc..a8a483f777 100644 --- a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs +++ b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs @@ -106,7 +106,7 @@ public class NoopPushNotificationService : IPushNotificationService return Task.FromResult(0); } - public Task PushSyncNotificationAsync(Notification notification) => Task.CompletedTask; + public Task PushNotificationAsync(Notification notification) => Task.CompletedTask; - public Task PushSyncNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) => Task.CompletedTask; + public Task PushNotificationStatusAsync(Notification notification, NotificationStatus notificationStatus) => Task.CompletedTask; } diff --git a/src/Notifications/HubHelpers.cs b/src/Notifications/HubHelpers.cs index 0f32529196..228addac3d 100644 --- a/src/Notifications/HubHelpers.cs +++ b/src/Notifications/HubHelpers.cs @@ -92,7 +92,7 @@ public static class HubHelpers case PushType.SyncNotification: case PushType.SyncNotificationStatus: var syncNotification = - JsonSerializer.Deserialize>( + JsonSerializer.Deserialize>( notificationJson, _deserializerOptions); if (syncNotification.Payload.UserId.HasValue) { diff --git a/test/Core.Test/NotificationCenter/Commands/CreateNotificationCommandTest.cs b/test/Core.Test/NotificationCenter/Commands/CreateNotificationCommandTest.cs index eaa15a02d7..dd0f2d33f9 100644 --- a/test/Core.Test/NotificationCenter/Commands/CreateNotificationCommandTest.cs +++ b/test/Core.Test/NotificationCenter/Commands/CreateNotificationCommandTest.cs @@ -43,10 +43,10 @@ public class CreateNotificationCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.CreateAsync(notification)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); } [Theory] @@ -64,9 +64,9 @@ public class CreateNotificationCommandTest Assert.Equal(notification.CreationDate, notification.RevisionDate); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationAsync(newNotification); + .PushNotificationAsync(newNotification); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); } } diff --git a/test/Core.Test/NotificationCenter/Commands/CreateNotificationStatusCommandTest.cs b/test/Core.Test/NotificationCenter/Commands/CreateNotificationStatusCommandTest.cs index 7eedbfd8ca..11cde15e2e 100644 --- a/test/Core.Test/NotificationCenter/Commands/CreateNotificationStatusCommandTest.cs +++ b/test/Core.Test/NotificationCenter/Commands/CreateNotificationStatusCommandTest.cs @@ -53,10 +53,10 @@ public class CreateNotificationStatusCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.CreateAsync(notificationStatus)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -70,10 +70,10 @@ public class CreateNotificationStatusCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.CreateAsync(notificationStatus)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -87,10 +87,10 @@ public class CreateNotificationStatusCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.CreateAsync(notificationStatus)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -106,9 +106,9 @@ public class CreateNotificationStatusCommandTest Assert.Equal(notificationStatus, newNotificationStatus); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationStatusAsync(notification, notificationStatus); + .PushNotificationStatusAsync(notification, notificationStatus); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } } diff --git a/test/Core.Test/NotificationCenter/Commands/MarkNotificationDeletedCommandTest.cs b/test/Core.Test/NotificationCenter/Commands/MarkNotificationDeletedCommandTest.cs index 3d698074da..924cd38351 100644 --- a/test/Core.Test/NotificationCenter/Commands/MarkNotificationDeletedCommandTest.cs +++ b/test/Core.Test/NotificationCenter/Commands/MarkNotificationDeletedCommandTest.cs @@ -66,10 +66,10 @@ public class MarkNotificationDeletedCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkDeletedAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -83,10 +83,10 @@ public class MarkNotificationDeletedCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkDeletedAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -101,10 +101,10 @@ public class MarkNotificationDeletedCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkDeletedAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -119,10 +119,10 @@ public class MarkNotificationDeletedCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkDeletedAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -137,10 +137,10 @@ public class MarkNotificationDeletedCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkDeletedAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -164,11 +164,11 @@ public class MarkNotificationDeletedCommandTest .CreateAsync(Arg.Do(ns => AssertNotificationStatus(expectedNotificationStatus, ns))); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationStatusAsync(notification, + .PushNotificationStatusAsync(notification, Arg.Do(ns => AssertNotificationStatus(expectedNotificationStatus, ns))); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -185,11 +185,11 @@ public class MarkNotificationDeletedCommandTest .UpdateAsync(Arg.Do(ns => AssertNotificationStatus(notificationStatus, ns))); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationStatusAsync(notification, + .PushNotificationStatusAsync(notification, Arg.Do(ns => AssertNotificationStatus(notificationStatus, ns))); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } private static void AssertNotificationStatus(NotificationStatus expectedNotificationStatus, diff --git a/test/Core.Test/NotificationCenter/Commands/MarkNotificationReadCommandTest.cs b/test/Core.Test/NotificationCenter/Commands/MarkNotificationReadCommandTest.cs index 999f95c402..2fef97b115 100644 --- a/test/Core.Test/NotificationCenter/Commands/MarkNotificationReadCommandTest.cs +++ b/test/Core.Test/NotificationCenter/Commands/MarkNotificationReadCommandTest.cs @@ -66,10 +66,10 @@ public class MarkNotificationReadCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkReadAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -83,10 +83,10 @@ public class MarkNotificationReadCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkReadAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -101,10 +101,10 @@ public class MarkNotificationReadCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkReadAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -119,10 +119,10 @@ public class MarkNotificationReadCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkReadAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -137,10 +137,10 @@ public class MarkNotificationReadCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.MarkReadAsync(notificationId)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -164,11 +164,11 @@ public class MarkNotificationReadCommandTest .CreateAsync(Arg.Do(ns => AssertNotificationStatus(expectedNotificationStatus, ns))); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationStatusAsync(notification, + .PushNotificationStatusAsync(notification, Arg.Do(ns => AssertNotificationStatus(expectedNotificationStatus, ns))); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } [Theory] @@ -185,11 +185,11 @@ public class MarkNotificationReadCommandTest .UpdateAsync(Arg.Do(ns => AssertNotificationStatus(notificationStatus, ns))); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationStatusAsync(notification, + .PushNotificationStatusAsync(notification, Arg.Do(ns => AssertNotificationStatus(notificationStatus, ns))); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); } private static void AssertNotificationStatus(NotificationStatus expectedNotificationStatus, diff --git a/test/Core.Test/NotificationCenter/Commands/UpdateNotificationCommandTest.cs b/test/Core.Test/NotificationCenter/Commands/UpdateNotificationCommandTest.cs index a36ac55d7e..5025282160 100644 --- a/test/Core.Test/NotificationCenter/Commands/UpdateNotificationCommandTest.cs +++ b/test/Core.Test/NotificationCenter/Commands/UpdateNotificationCommandTest.cs @@ -48,10 +48,10 @@ public class UpdateNotificationCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.UpdateAsync(notification)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); } [Theory] @@ -65,10 +65,10 @@ public class UpdateNotificationCommandTest await Assert.ThrowsAsync(() => sutProvider.Sut.UpdateAsync(notification)); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationAsync(Arg.Any()); + .PushNotificationAsync(Arg.Any()); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); } [Theory] @@ -106,9 +106,9 @@ public class UpdateNotificationCommandTest DateTime.UtcNow - n.RevisionDate < TimeSpan.FromMinutes(1))); await sutProvider.GetDependency() .Received(1) - .PushSyncNotificationAsync(notification); + .PushNotificationAsync(notification); await sutProvider.GetDependency() .Received(0) - .PushSyncNotificationStatusAsync(Arg.Any(), Arg.Any()); + .PushNotificationStatusAsync(Arg.Any(), Arg.Any()); } } diff --git a/test/Core.Test/NotificationHub/NotificationHubPushNotificationServiceTests.cs b/test/Core.Test/NotificationHub/NotificationHubPushNotificationServiceTests.cs index 728f2810df..2b8ff88dc1 100644 --- a/test/Core.Test/NotificationHub/NotificationHubPushNotificationServiceTests.cs +++ b/test/Core.Test/NotificationHub/NotificationHubPushNotificationServiceTests.cs @@ -21,10 +21,10 @@ public class NotificationHubPushNotificationServiceTests [Theory] [BitAutoData] [NotificationCustomize] - public async Task PushSyncNotificationAsync_Global_NotSent( + public async Task PushNotificationAsync_Global_NotSent( SutProvider sutProvider, Notification notification) { - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await sutProvider.GetDependency() .Received(0) @@ -40,7 +40,7 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(false)] [BitAutoData(true)] [NotificationCustomize(false)] - public async Task PushSyncNotificationAsync_UserIdProvidedClientTypeAll_SentToUser( + public async Task PushNotificationAsync_UserIdProvidedClientTypeAll_SentToUser( bool organizationIdNull, SutProvider sutProvider, Notification notification) { @@ -50,12 +50,12 @@ public class NotificationHubPushNotificationServiceTests } notification.ClientType = ClientType.All; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, null); + var expectedNotification = ToNotificationPushNotification(notification, null); - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification, - expectedSyncNotification, + expectedNotification, $"(template:payload_userId:{notification.UserId})"); await sutProvider.GetDependency() .Received(0) @@ -68,18 +68,18 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(ClientType.Web)] [BitAutoData(ClientType.Mobile)] [NotificationCustomize(false)] - public async Task PushSyncNotificationAsync_UserIdProvidedOrganizationIdNullClientTypeNotAll_SentToUser( + public async Task PushNotificationAsync_UserIdProvidedOrganizationIdNullClientTypeNotAll_SentToUser( ClientType clientType, SutProvider sutProvider, Notification notification) { notification.OrganizationId = null; notification.ClientType = clientType; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, null); + var expectedNotification = ToNotificationPushNotification(notification, null); - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification, - expectedSyncNotification, + expectedNotification, $"(template:payload_userId:{notification.UserId} && clientType:{clientType})"); await sutProvider.GetDependency() .Received(0) @@ -92,17 +92,17 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(ClientType.Web)] [BitAutoData(ClientType.Mobile)] [NotificationCustomize(false)] - public async Task PushSyncNotificationAsync_UserIdProvidedOrganizationIdProvidedClientTypeNotAll_SentToUser( + public async Task PushNotificationAsync_UserIdProvidedOrganizationIdProvidedClientTypeNotAll_SentToUser( ClientType clientType, SutProvider sutProvider, Notification notification) { notification.ClientType = clientType; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, null); + var expectedNotification = ToNotificationPushNotification(notification, null); - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification, - expectedSyncNotification, + expectedNotification, $"(template:payload_userId:{notification.UserId} && clientType:{clientType})"); await sutProvider.GetDependency() .Received(0) @@ -112,17 +112,17 @@ public class NotificationHubPushNotificationServiceTests [Theory] [BitAutoData] [NotificationCustomize(false)] - public async Task PushSyncNotificationAsync_UserIdNullOrganizationIdProvidedClientTypeAll_SentToOrganization( + public async Task PushNotificationAsync_UserIdNullOrganizationIdProvidedClientTypeAll_SentToOrganization( SutProvider sutProvider, Notification notification) { notification.UserId = null; notification.ClientType = ClientType.All; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, null); + var expectedNotification = ToNotificationPushNotification(notification, null); - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification, - expectedSyncNotification, + expectedNotification, $"(template:payload && organizationId:{notification.OrganizationId})"); await sutProvider.GetDependency() .Received(0) @@ -135,18 +135,18 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(ClientType.Web)] [BitAutoData(ClientType.Mobile)] [NotificationCustomize(false)] - public async Task PushSyncNotificationAsync_UserIdNullOrganizationIdProvidedClientTypeNotAll_SentToOrganization( + public async Task PushNotificationAsync_UserIdNullOrganizationIdProvidedClientTypeNotAll_SentToOrganization( ClientType clientType, SutProvider sutProvider, Notification notification) { notification.UserId = null; notification.ClientType = clientType; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, null); + var expectedNotification = ToNotificationPushNotification(notification, null); - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification, - expectedSyncNotification, + expectedNotification, $"(template:payload && organizationId:{notification.OrganizationId} && clientType:{clientType})"); await sutProvider.GetDependency() .Received(0) @@ -156,11 +156,11 @@ public class NotificationHubPushNotificationServiceTests [Theory] [BitAutoData] [NotificationCustomize] - public async Task PushSyncNotificationStatusAsync_Global_NotSent( + public async Task PushNotificationStatusAsync_Global_NotSent( SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await sutProvider.GetDependency() .Received(0) @@ -176,7 +176,7 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(false)] [BitAutoData(true)] [NotificationCustomize(false)] - public async Task PushSyncNotificationStatusAsync_UserIdProvidedClientTypeAll_SentToUser( + public async Task PushNotificationStatusAsync_UserIdProvidedClientTypeAll_SentToUser( bool organizationIdNull, SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { @@ -186,12 +186,12 @@ public class NotificationHubPushNotificationServiceTests } notification.ClientType = ClientType.All; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, notificationStatus); + var expectedNotification = ToNotificationPushNotification(notification, notificationStatus); - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus, - expectedSyncNotification, + expectedNotification, $"(template:payload_userId:{notification.UserId})"); await sutProvider.GetDependency() .Received(0) @@ -204,18 +204,18 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(ClientType.Web)] [BitAutoData(ClientType.Mobile)] [NotificationCustomize(false)] - public async Task PushSyncNotificationStatusAsync_UserIdProvidedOrganizationIdNullClientTypeNotAll_SentToUser( + public async Task PushNotificationStatusAsync_UserIdProvidedOrganizationIdNullClientTypeNotAll_SentToUser( ClientType clientType, SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { notification.OrganizationId = null; notification.ClientType = clientType; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, notificationStatus); + var expectedNotification = ToNotificationPushNotification(notification, notificationStatus); - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus, - expectedSyncNotification, + expectedNotification, $"(template:payload_userId:{notification.UserId} && clientType:{clientType})"); await sutProvider.GetDependency() .Received(0) @@ -228,17 +228,17 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(ClientType.Web)] [BitAutoData(ClientType.Mobile)] [NotificationCustomize(false)] - public async Task PushSyncNotificationStatusAsync_UserIdProvidedOrganizationIdProvidedClientTypeNotAll_SentToUser( + public async Task PushNotificationStatusAsync_UserIdProvidedOrganizationIdProvidedClientTypeNotAll_SentToUser( ClientType clientType, SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { notification.ClientType = clientType; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, notificationStatus); + var expectedNotification = ToNotificationPushNotification(notification, notificationStatus); - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus, - expectedSyncNotification, + expectedNotification, $"(template:payload_userId:{notification.UserId} && clientType:{clientType})"); await sutProvider.GetDependency() .Received(0) @@ -248,18 +248,18 @@ public class NotificationHubPushNotificationServiceTests [Theory] [BitAutoData] [NotificationCustomize(false)] - public async Task PushSyncNotificationStatusAsync_UserIdNullOrganizationIdProvidedClientTypeAll_SentToOrganization( + public async Task PushNotificationStatusAsync_UserIdNullOrganizationIdProvidedClientTypeAll_SentToOrganization( SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { notification.UserId = null; notification.ClientType = ClientType.All; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, notificationStatus); + var expectedNotification = ToNotificationPushNotification(notification, notificationStatus); - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus, - expectedSyncNotification, + expectedNotification, $"(template:payload && organizationId:{notification.OrganizationId})"); await sutProvider.GetDependency() .Received(0) @@ -273,18 +273,18 @@ public class NotificationHubPushNotificationServiceTests [BitAutoData(ClientType.Mobile)] [NotificationCustomize(false)] public async Task - PushSyncNotificationStatusAsync_UserIdNullOrganizationIdProvidedClientTypeNotAll_SentToOrganization( + PushNotificationStatusAsync_UserIdNullOrganizationIdProvidedClientTypeNotAll_SentToOrganization( ClientType clientType, SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { notification.UserId = null; notification.ClientType = clientType; - var expectedSyncNotification = ToSyncNotificationPushNotification(notification, notificationStatus); + var expectedNotification = ToNotificationPushNotification(notification, notificationStatus); - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus, - expectedSyncNotification, + expectedNotification, $"(template:payload && organizationId:{notification.OrganizationId} && clientType:{clientType})"); await sutProvider.GetDependency() .Received(0) @@ -363,14 +363,19 @@ public class NotificationHubPushNotificationServiceTests .UpsertAsync(Arg.Any()); } - private static SyncNotificationPushNotification ToSyncNotificationPushNotification(Notification notification, + private static NotificationPushNotification ToNotificationPushNotification(Notification notification, NotificationStatus? notificationStatus) => new() { Id = notification.Id, + Priority = notification.Priority, + Global = notification.Global, + ClientType = notification.ClientType, UserId = notification.UserId, OrganizationId = notification.OrganizationId, - ClientType = notification.ClientType, + Title = notification.Title, + Body = notification.Body, + CreationDate = notification.CreationDate, RevisionDate = notification.RevisionDate, ReadDate = notificationStatus?.ReadDate, DeletedDate = notificationStatus?.DeletedDate diff --git a/test/Core.Test/Services/AzureQueuePushNotificationServiceTests.cs b/test/Core.Test/Services/AzureQueuePushNotificationServiceTests.cs index e702a267e6..54407177f3 100644 --- a/test/Core.Test/Services/AzureQueuePushNotificationServiceTests.cs +++ b/test/Core.Test/Services/AzureQueuePushNotificationServiceTests.cs @@ -25,7 +25,7 @@ public class AzureQueuePushNotificationServiceTests [BitAutoData] [NotificationCustomize] [CurrentContextCustomize] - public async Task PushSyncNotificationAsync_Notification_Sent( + public async Task PushNotificationAsync_Notification_Sent( SutProvider sutProvider, Notification notification, Guid deviceIdentifier, ICurrentContext currentContext) { @@ -33,11 +33,12 @@ public class AzureQueuePushNotificationServiceTests sutProvider.GetDependency().HttpContext!.RequestServices .GetService(Arg.Any()).Returns(currentContext); - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await sutProvider.GetDependency().Received(1) .SendMessageAsync(Arg.Is(message => - MatchMessage(PushType.SyncNotification, message, new SyncNotificationEquals(notification, null), + MatchMessage(PushType.SyncNotification, message, + new NotificationPushNotificationEquals(notification, null), deviceIdentifier.ToString()))); } @@ -46,7 +47,7 @@ public class AzureQueuePushNotificationServiceTests [NotificationCustomize] [NotificationStatusCustomize] [CurrentContextCustomize] - public async Task PushSyncNotificationStatusAsync_Notification_Sent( + public async Task PushNotificationStatusAsync_Notification_Sent( SutProvider sutProvider, Notification notification, Guid deviceIdentifier, ICurrentContext currentContext, NotificationStatus notificationStatus) { @@ -54,36 +55,42 @@ public class AzureQueuePushNotificationServiceTests sutProvider.GetDependency().HttpContext!.RequestServices .GetService(Arg.Any()).Returns(currentContext); - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await sutProvider.GetDependency().Received(1) .SendMessageAsync(Arg.Is(message => MatchMessage(PushType.SyncNotificationStatus, message, - new SyncNotificationEquals(notification, notificationStatus), + new NotificationPushNotificationEquals(notification, notificationStatus), deviceIdentifier.ToString()))); } private static bool MatchMessage(PushType pushType, string message, IEquatable expectedPayloadEquatable, string contextId) { - var pushNotificationData = - JsonSerializer.Deserialize>(message); + var pushNotificationData = JsonSerializer.Deserialize>(message); return pushNotificationData != null && pushNotificationData.Type == pushType && expectedPayloadEquatable.Equals(pushNotificationData.Payload) && pushNotificationData.ContextId == contextId; } - private class SyncNotificationEquals(Notification notification, NotificationStatus? notificationStatus) - : IEquatable + private class NotificationPushNotificationEquals(Notification notification, NotificationStatus? notificationStatus) + : IEquatable { - public bool Equals(SyncNotificationPushNotification? other) + public bool Equals(NotificationPushNotification? other) { return other != null && other.Id == notification.Id && - other.UserId == notification.UserId && - other.OrganizationId == notification.OrganizationId && + other.Priority == notification.Priority && + other.Global == notification.Global && other.ClientType == notification.ClientType && + other.UserId.HasValue == notification.UserId.HasValue && + other.UserId == notification.UserId && + other.OrganizationId.HasValue == notification.OrganizationId.HasValue && + other.OrganizationId == notification.OrganizationId && + other.Title == notification.Title && + other.Body == notification.Body && + other.CreationDate == notification.CreationDate && other.RevisionDate == notification.RevisionDate && other.ReadDate == notificationStatus?.ReadDate && other.DeletedDate == notificationStatus?.DeletedDate; diff --git a/test/Core.Test/Services/MultiServicePushNotificationServiceTests.cs b/test/Core.Test/Services/MultiServicePushNotificationServiceTests.cs index 1181f88300..e59c1df0e5 100644 --- a/test/Core.Test/Services/MultiServicePushNotificationServiceTests.cs +++ b/test/Core.Test/Services/MultiServicePushNotificationServiceTests.cs @@ -16,31 +16,31 @@ public class MultiServicePushNotificationServiceTests [Theory] [BitAutoData] [NotificationCustomize] - public async Task PushSyncNotificationAsync_Notification_Sent( + public async Task PushNotificationAsync_Notification_Sent( SutProvider sutProvider, Notification notification) { - await sutProvider.Sut.PushSyncNotificationAsync(notification); + await sutProvider.Sut.PushNotificationAsync(notification); await sutProvider.GetDependency>() .First() .Received(1) - .PushSyncNotificationAsync(notification); + .PushNotificationAsync(notification); } [Theory] [BitAutoData] [NotificationCustomize] [NotificationStatusCustomize] - public async Task PushSyncNotificationStatusAsync_Notification_Sent( + public async Task PushNotificationStatusAsync_Notification_Sent( SutProvider sutProvider, Notification notification, NotificationStatus notificationStatus) { - await sutProvider.Sut.PushSyncNotificationStatusAsync(notification, notificationStatus); + await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus); await sutProvider.GetDependency>() .First() .Received(1) - .PushSyncNotificationStatusAsync(notification, notificationStatus); + .PushNotificationStatusAsync(notification, notificationStatus); } [Theory]