mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
PM-10564: Sync notification push type separation for notification updates
Sync notification push type is now used for both Notification create and update. Renamed the event types to specifically mention the purpose of status for notification status updates.
This commit is contained in:
@ -43,7 +43,10 @@ public class CreateNotificationCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notification));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationCreateAsync(Arg.Any<Notification>());
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -61,6 +64,9 @@ public class CreateNotificationCommandTest
|
||||
Assert.Equal(notification.CreationDate, notification.RevisionDate);
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationCreateAsync(newNotification);
|
||||
.PushSyncNotificationAsync(newNotification);
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,10 @@ public class CreateNotificationStatusCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notificationStatus));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -67,7 +70,10 @@ public class CreateNotificationStatusCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notificationStatus));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -81,7 +87,10 @@ public class CreateNotificationStatusCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.CreateAsync(notificationStatus));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -97,6 +106,9 @@ public class CreateNotificationStatusCommandTest
|
||||
Assert.Equal(notificationStatus, newNotificationStatus);
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationUpdateAsync(notification, notificationStatus);
|
||||
.PushSyncNotificationStatusAsync(notification, notificationStatus);
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,10 @@ public class MarkNotificationDeletedCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkDeletedAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -80,7 +83,10 @@ public class MarkNotificationDeletedCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkDeletedAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -95,7 +101,10 @@ public class MarkNotificationDeletedCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkDeletedAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -110,7 +119,10 @@ public class MarkNotificationDeletedCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkDeletedAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -125,7 +137,10 @@ public class MarkNotificationDeletedCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkDeletedAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -149,8 +164,11 @@ public class MarkNotificationDeletedCommandTest
|
||||
.CreateAsync(Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(expectedNotificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationUpdateAsync(notification,
|
||||
.PushSyncNotificationStatusAsync(notification,
|
||||
Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(expectedNotificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -167,8 +185,11 @@ public class MarkNotificationDeletedCommandTest
|
||||
.UpdateAsync(Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(notificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationUpdateAsync(notification,
|
||||
Arg.Do<NotificationStatus?>(ns => AssertNotificationStatus(notificationStatus, ns)));
|
||||
.PushSyncNotificationStatusAsync(notification,
|
||||
Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(notificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
private static void AssertNotificationStatus(NotificationStatus expectedNotificationStatus,
|
||||
|
@ -66,7 +66,10 @@ public class MarkNotificationReadCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkReadAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -80,7 +83,10 @@ public class MarkNotificationReadCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkReadAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -95,7 +101,10 @@ public class MarkNotificationReadCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkReadAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -110,7 +119,10 @@ public class MarkNotificationReadCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkReadAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -125,7 +137,10 @@ public class MarkNotificationReadCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.MarkReadAsync(notificationId));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -149,8 +164,11 @@ public class MarkNotificationReadCommandTest
|
||||
.CreateAsync(Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(expectedNotificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationUpdateAsync(notification,
|
||||
.PushSyncNotificationStatusAsync(notification,
|
||||
Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(expectedNotificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -167,8 +185,11 @@ public class MarkNotificationReadCommandTest
|
||||
.UpdateAsync(Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(notificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationUpdateAsync(notification,
|
||||
Arg.Do<NotificationStatus?>(ns => AssertNotificationStatus(notificationStatus, ns)));
|
||||
.PushSyncNotificationStatusAsync(notification,
|
||||
Arg.Do<NotificationStatus>(ns => AssertNotificationStatus(notificationStatus, ns)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
}
|
||||
|
||||
private static void AssertNotificationStatus(NotificationStatus expectedNotificationStatus,
|
||||
|
@ -48,7 +48,10 @@ public class UpdateNotificationCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.UpdateAsync(notification));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -62,7 +65,10 @@ public class UpdateNotificationCommandTest
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.UpdateAsync(notification));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationUpdateAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus?>());
|
||||
.PushSyncNotificationAsync(Arg.Any<Notification>());
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -100,6 +106,9 @@ public class UpdateNotificationCommandTest
|
||||
DateTime.UtcNow - n.RevisionDate < TimeSpan.FromMinutes(1)));
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(1)
|
||||
.PushSyncNotificationUpdateAsync(notification, null);
|
||||
.PushSyncNotificationAsync(notification);
|
||||
await sutProvider.GetDependency<IPushNotificationService>()
|
||||
.Received(0)
|
||||
.PushSyncNotificationStatusAsync(Arg.Any<Notification>(), Arg.Any<NotificationStatus>());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user