Пример #1
0
        public async Task InvokeSendSmsAsyncWithTheCorrectQueueNameAndMessage()
        {
            const string phoneNumber = "*****@*****.**";
            const string smsMesssage = "test message body";

            var mediator            = MockIMediator();
            var queueStorageService = new Mock <IQueueStorageService>();

            var messageSender = new AuthMessageSender(mediator.Object, queueStorageService.Object);
            await messageSender.SendSmsAsync(phoneNumber, smsMesssage);

            queueStorageService.Verify(x => x.SendMessageAsync(QueueStorageService.Queues.SmsQueue,
                                                               @"{""Recipient"":""*****@*****.**"",""Message"":""test message body""}"));
        }
Пример #2
0
        public void SendSmsAsyncShouldPutCommandOnBus()
        {
            const string smsRecipient = "*****@*****.**";
            const string smsMesssage  = "test message body";

            var bus           = MockIMediator();
            var messageSender = new AuthMessageSender(bus.Object);

            messageSender.SendSmsAsync(smsRecipient, smsMesssage);
            bus.Verify(mock => mock.Send(
                           It.Is <NotifyVolunteersCommand>(request =>
                                                           request.ViewModel.SmsMessage == smsMesssage &&
                                                           request.ViewModel.SmsRecipients.SequenceEqual(new List <string> {
                smsRecipient
            }))),
                       Times.Exactly(1));
        }