public void SendMailToAdmin(EmailRequest emailRequest)
        {
            var userDetails = _httpClientWrapper.GetData("getAdminUsers");

            EmailTemplate mailtemplete = _mailTemplateAdapter.GetEmailTemplates(emailRequest.type);

            foreach (var admin in userDetails)
            {
                try
                {
                    var mailBody = CreatMailBody(admin.emailid, mailtemplete);
                    emailRequest.subject   = _subject;
                    emailRequest.emailbody = mailBody;
                    _email.SendEmail(admin.emailid, mailBody, _subject);
                    emailRequest.status = "Success";
                    _mailTemplateAdapter.InsertEmailRequest(emailRequest);
                }
                catch (Exception)
                {
                    emailRequest.status = "Failed";
                    emailRequest.mailto = admin.emailid;
                    _mailTemplateAdapter.InsertEmailRequest(emailRequest);
                }
            }
        }
 public BeverageDataServiceTests()
 {
     _httpClientWrapper = Substitute.For <IHttpClientWrapper>();
     _httpClientWrapper.GetData().Returns(CreateSystembolagetApiData());
     _sut = new BeverageDataService(_httpClientWrapper);
 }
Exemplo n.º 3
0
        public async Task <IEnumerable <Beverage> > GetBeverageData()
        {
            var apiResponse = await _httpClientWrapper.GetData();

            return(JsonConvert.DeserializeObject <IEnumerable <Beverage> >(apiResponse));
        }