private void AddToListSimpleException(SimpleExpection emailSimpleException, List<Sender> exceptionList, string toAddress) { emailSimpleException.Message = _errorMessage.Message; emailSimpleException.Source = _errorMessage.Source; emailSimpleException.ToAddress = toAddress; exceptionList.Add(emailSimpleException); }
public void Handle() { List<Sender> exceptionList=new List<Sender>(); if(_errorMessage.InnerException==null) { var emailnullException=new NullException(new EmailException()); AddToListNullException(emailnullException, exceptionList, "*****@*****.**"); var smsnullException = new NullException(new SmsException()); AddToListNullException(smsnullException, exceptionList, "07771216871"); var lognullException = new NullException(new LogException()); AddToListNullException(lognullException, exceptionList, "nulllog.txt"); } else { var emailsimpleException = new SimpleExpection(new EmailException()); AddToListSimpleException(emailsimpleException, exceptionList, "*****@*****.**"); var smsSimpleException = new SimpleExpection(new SmsException()); AddToListSimpleException(smsSimpleException, exceptionList, "07771216872"); var lognsimpleException = new SimpleExpection(new LogException()); AddToListSimpleException(lognsimpleException, exceptionList, "simplelog.txt"); } foreach (var exp in exceptionList) { sendStatus.Add(exp.Send()); } }