public async Task DispatchVolunteerAssignedNotification() { var mockMediator = new Mock <IMediator>(); var mockGeneralSettings = new Mock <IOptions <GeneralSettings> >(); mockGeneralSettings.SetupGet(m => m.Value).Returns(new GeneralSettings { SiteBaseUrl = "http://localhost/" }); var handler = new ItineraryVolunteerListUpdatedHandler(Context, mockMediator.Object, mockGeneralSettings.Object); await handler.Handle(new ItineraryVolunteerListUpdated { TaskSignupId = 1, ItineraryId = 1, UpdateType = UpdateType.VolunteerAssigned }); mockMediator.Verify(m => m.SendAsync(It.Is <NotifyVolunteersCommand>(command => string.Equals(command.ViewModel.SmsMessage, $"You’ve been assigned to a team for {_itineraryDate} http://localhost/v") && string.Equals(command.ViewModel.Subject, $"You've been assigned to a team for {_itineraryDate}") && string.Equals(command.ViewModel.HtmlMessage, $"The volunteer organizer has assigned you to a team for {_itineraryDate}. See your http://localhost/v for more information.") )), Times.Once); }
public async Task DispatchNotificationToTheEmailAddressAndPhoneNumber() { var mockMediator = new Mock <IMediator>(); var mockGeneralSettings = new Mock <IOptions <GeneralSettings> >(); mockGeneralSettings.SetupGet(m => m.Value).Returns(new GeneralSettings { SiteBaseUrl = string.Empty }); var handler = new ItineraryVolunteerListUpdatedHandler(Context, mockMediator.Object, mockGeneralSettings.Object); await handler.Handle(new ItineraryVolunteerListUpdated { TaskSignupId = 1, ItineraryId = 1 }); mockMediator.Verify(m => m.SendAsync(It.Is <NotifyVolunteersCommand>(command => command.ViewModel.SmsRecipients.Count == 1 && command.ViewModel.SmsRecipients[0] == _taskSignup.User.PhoneNumber && command.ViewModel.EmailRecipients.Count == 1 && command.ViewModel.EmailRecipients[0] == _taskSignup.User.Email )), Times.Once); }