Example #1
0
        public async Task SendSmsWithoutParametersShouldThrowException()
        {
            ISmsNotification emptySmsNotification = null;
            var source = new Mock <ISmsSender>();
            TwilioSmsConfiguration emptyConfig = new TwilioSmsConfiguration();
            var mockSmsService = new SmsNotificationService(source.Object);

            await Assert.ThrowsAsync <ArgumentNullException>(() => mockSmsService.SendAsync(emptySmsNotification));
        }
Example #2
0
        public async Task SendSmsNotification()
        {
            var smsSender  = new TwilioSmsSender(_smsConfiguration.Configuration, _smsConfiguration.TwilioRestClient);
            var smsService = new SmsNotificationService(smsSender);
            var recipients = new List <string>()
            {
                _smsConfiguration.RecipientPhoneNumber
            };
            var sms = new BaseSmsNotification()
            {
                Text = SmsText, RecipientPhoneNumbers = recipients
            };

            await smsService.SendAsync(sms);
        }