public async Task Notifications_Service_Is_Called( SendEmailsCommand command, [Frozen] Mock <INotificationService> notificationsService, SendEmailsCommandHandler handler ) { await handler.Handle(command, CancellationToken.None); notificationsService.Verify(x => x.Send(It.IsAny <SendEmailCommand>()), Times.Exactly(command.EmailDataList.Count)); }
public async Task Consume(ConsumeContext <IUserRegistredEvent> context) { var contract = new SendEmailsCommand { Name = context.Message.Name, Emails = "[email protected]; [email protected]" }; var endpoint = Program.ConnectionProvider.GetEndpoint(KnownServicesTypes.SendEmailsCommandHandler); var sendEndpoint = await context.GetSendEndpoint(endpoint); await sendEndpoint.Send(contract); }