public async Task GivenLiveVacancyUpdatedEventWithNoDateChange_ThenDoNotNotifyLiveVacancyChanged() { var @event = new LiveVacancyUpdatedEvent { VacancyId = _existingVacancy.Id, VacancyReference = _existingVacancy.VacancyReference.Value, UpdateKind = LiveUpdateKind.None }; await _handler.Handle(@event, CancellationToken.None); _mockNotifier .Verify(x => x.LiveVacancyChanged(_existingVacancy), Times.Never); }
public async Task Handle(LiveVacancyUpdatedEvent notification, CancellationToken cancellationToken) { try { var vacancy = await _vacancyRepository.GetVacancyAsync(notification.VacancyId); switch (notification.UpdateKind) { case LiveUpdateKind.ClosingDate: case LiveUpdateKind.StartDate: case LiveUpdateKind.ClosingDate | LiveUpdateKind.StartDate: await _vacancyStatusNotifier.LiveVacancyChanged(vacancy); break; default: break; } } catch (NotificationException ex) { _logger.LogError(ex, $"Unable to send notification for {nameof(LiveVacancyUpdatedEvent)} and VacancyReference: {{vacancyReference}}", notification.VacancyReference); } }