public void CanSendSMSWhenUserRequestForgottenPasswordReminder() { smsSender.SendSMS(null, null); LastCall.Constraints(Is.Equal("1234"), Text.StartsWith("new password: "******"Should send sms"); mocks.ReplayAll(); LoginController controller = new LoginController(userRepository, smsSender); controller.ForgottenPassword("sally"); }
public string Get(string country) { //assign interface that implemented class for country code _smsSender = IoCUtil.Resolve <ISmsSender>(country); //controller never know anything about country return(_smsSender.SendSMS()); }
public async Task <IActionResult> SavePhone(SmsUser model) { if (ModelState.IsValid) { await _smsSender.SendSMS(model.PhoneNumber, "Test code"); return(View("SendCode", new SendCodeModel { PhoneNumber = model.PhoneNumber })); } return(View("~/Views/Home/Index.cshtml", model)); }
private void SendBtn_Click(object sender, EventArgs e) { jobSys = SmsFactory.getSystem("eJobs"); jobSys.SendSMS("09950753794", "Pickup Details" + "Date:18 Jul 2018 (Wed)" + "Time&Location:12:00:00 Airport" + "Guest:Admin Test #09950753794" + "Driver:Supplier #09950753794" + "Unit:Default "); //jobSys.updateRecordStatus(1); //jobSys.insertLog(2003,"Sent"); //LoadSentItems(); LoadLogs(); }
public void ForgottenPassword(string userName) { Console.WriteLine("Sending SMS to {0}", userRepository.GetByUserName(userName).Name); User user = userRepository.GetByUserName(userName); try { DateTime start = DateTime.Now; smsSender.SendSMS(user.Phone, "new password: "******"Took {0} to send SMS to {1}", duration, user.Name); smsSendTookTooLong.Add(msg); } } catch (Exception e) { failuresToSendSms.Add(e); } }
public async Task <IEnumerable <Result> > SendToSmsUsers(string message) { var smsUsers = await _repository.GetSmsUsersAsync(); var results = new List <Result>(); if (smsUsers.Any()) { var destinations = smsUsers.Select(x => x.PhoneNumber).ToList(); results.AddRange(await _smsSender.SendSMS(destinations, message)); } else { _logger.LogError(Messages.NoSmsUser, message); results.Add(new Result() { ErrorMessage = Messages.NoSmsUser }); } return(results); }