public void SendBlindSpotMail(EmailRequest emailRequest)
        {
            EmailTemplate mailtemplete = _mailTemplateAdapter.GetEmailTemplates(emailRequest.type);

            foreach (var coworker in emailRequest.coworkers)
            {
                try
                {
                    var mailBody = CreatMailBody(coworker, mailtemplete);
                    emailRequest.subject   = _subject;
                    emailRequest.emailbody = mailBody;
                    _email.SendEmail(coworker, mailBody, _subject);
                    emailRequest.status = "Success";
                    _mailTemplateAdapter.InsertEmailRequest(emailRequest);
                }
                catch (Exception)
                {
                    emailRequest.status = "Failed";
                    emailRequest.mailto = coworker;
                    _mailTemplateAdapter.InsertEmailRequest(emailRequest);
                }
            }
        }
示例#2
0
        public void InsertEmailRequest_ReturnsVoid()
        {
            _mockEmailRequest.Setup(x => x.InsertOne(It.IsAny <EmailRequest>(), It.IsAny <string>()));

            Assert.DoesNotThrow(() => _emailTemplateAdapter.InsertEmailRequest(new EmailRequest()));
        }