Пример #1
0
        public void when_email_is_send_then_it_should_be_passed_to_protocol_sender()
        {
            var pendingMessages = new [] { new ConcreteEmailMessage {
                                               EmailId = Guid.NewGuid(), EmailMessage = message
                                           } };

            pendingEmailsGetter.GetPendingMails().Returns(pendingMessages);

            Act();

            protocolEmailSender.Received().SendExternal(Arg.Any <EmailMessage>());
        }
Пример #2
0
        public void SendPendingEmails()
        {
            var pendingEmails = _pendingEmailsGetter.GetPendingMails();

            foreach (var emailToSend in pendingEmails)
            {
                var preparedEmail = ProcessEmail(emailToSend.EmailMessage);
                try
                {
                    _protocolEmailSender.SendExternal(preparedEmail);
                    _emailPersister.UpdateStatus(emailToSend.EmailId, EmailSendingStatus.Sent);
                }
                catch (Exception ex)
                {
                    _emailPersister.UpdateStatus(emailToSend.EmailId, EmailSendingStatus.Error);
                }
            }
        }