Example #1
0
 public void CanSendSms_WithoutExceptions()
 {
     var smsService = Scope.Resolve<ISmsService>();
     var sms = new SendSmsCommand
     {
         RecipientPhoneNumber = "+375293593295",
         Text = "SMS Service Test"
     };
     smsService.SendSms(sms);
 }
Example #2
0
 public void SendSms(SendSmsCommand command)
 {
     EnsureIsValid(command);
     try
     {
         if (_settings.UseLogger)
         {
             var smsModel = new SmsModel
             {
                 From = _settings.OutboundPhoneNumber,
                 Text = command.Text,
                 To = command.RecipientPhoneNumber
             };
             _deps.SmsLogger.Log(smsModel);
         }
         var client = _deps.TwilioClientFactory.Create();
         client.SendSmsMessage(_settings.OutboundPhoneNumber, command.RecipientPhoneNumber, command.Text);
     }
     catch (Exception ex)
     {
         throw new ServiceException("Can't send sms.", ex);
     }
 }