public void When_Map_WithEmailDataInputIsCalled_Then_PendingEmailIsReturned() { // Given var emailDataInput = new EmailDataInput { Sender = "*****@*****.**", Recipients = new List <string> { "*****@*****.**", "*****@*****.**" }, Subject = "Test subject", Body = "Test body" }; var emailsMapper = new EmailsMapper(); // When var email = emailsMapper.Map(emailDataInput); // Then Assert.Equal(emailDataInput.Sender, email.Sender); Assert.Equal(string.Join(Separator, emailDataInput.Recipients), email.Recipients); Assert.Equal(emailDataInput.Subject, email.Subject); Assert.Equal(emailDataInput.Body, email.Body); Assert.Equal(EmailStatus.Pending, email.EmailStatus); }
protected void Page_PreRender(object sender, EventArgs e) { emailLogEntries = EmailsMapper.GetAll().OrderByDescending(i => i.DateCreated).ToList(); var errors = new List <Elmah.ErrorLogEntry>(); var newErrors = new List <Elmah.ErrorLogEntry>(); Elmah.AccessErrorLog.GetDefault(null).GetErrors(0, 10, errors); foreach (var error in errors) { newErrors.Add(Elmah.AccessErrorLog.GetDefault(null).GetError(error.Id)); } errorLogEntries = newErrors.Select(i => i.Error).ToList(); Bind(); }
public void When_Map_WithEmailDataInputIsCalled_AndOneOfRecipientsEmailIsInvalid_Then_ArgumentExceptionIsThrown() { // Given var emailDataInput = new EmailDataInput { Sender = "*****@*****.**", Recipients = new List <string> { "*****@*****.**", "recipient" }, Subject = "Test subject", Body = "Test body" }; var emailsMapper = new EmailsMapper(); // When & Then var exception = Assert.Throws <ArgumentException>(() => emailsMapper.Map(emailDataInput)); Assert.Contains("'recipient' is not a valid email address", exception.Message); }