public async Task GiveInvalidNotificationId_ShouldRaiseNotFoundError2() { // Login user _currentUserServiceMock.Setup(m => m.UserId) .Returns(userId1.ToString()); var sut = new UnReadNotificationCommandHandler(_context, _currentUserServiceMock.Object); var command = new UnReadNotificationCommand() { NotificationId = Guid.NewGuid() }; await Should.ThrowAsync <NotFoundException>(() => sut.Handle(command, CancellationToken.None)); }
public async Task GiveValidNotificationId_ShouldSetNotificationToUnreadStatus() { // Login user _currentUserServiceMock.Setup(m => m.UserId) .Returns(userId1.ToString()); var sut = new UnReadNotificationCommandHandler(_context, _currentUserServiceMock.Object); var command = new UnReadNotificationCommand() { NotificationId = notificationIdRead }; await sut.Handle(command, CancellationToken.None); var entity = _context.Notifications.Find(notificationIdRead); entity.isRead.ShouldBeFalse(); }