public void TestAddThenCount() { var mailBag = new MailBag(); var message = CreateTestMailMessage(); mailBag.Add(message); Assert.That(mailBag.Count, Is.EqualTo(1)); }
public void TestAddThenGetAll() { var mailBag = new MailBag(); var message = CreateTestMailMessage(); mailBag.Add(message); var retrievedMessage = mailBag.All.First(); Assert.That(retrievedMessage, Is.SameAs(message)); }
public void TestAddThenGetBySender() { var mailBag = new MailBag(); var message = CreateTestMailMessage(); mailBag.Add(message); var retrievedMessage = mailBag.GetMailsWithSender(MailMessageData.Sender).First(); Assert.That(mailBag.ContainsMailWithSender(MailMessageData.Sender)); Assert.That(retrievedMessage, Is.SameAs(message)); }
private MailBag CreatePopulatedMailBag() { var mailBag = new MailBag(); for (int index = 0; index < MailMessageData.AlternativeRecipients.Length; index++) { mailBag.Add(CreateTestMailMessage(index)); } return(mailBag); }
public void TestAddWithNullSubject() { var mailBag = new MailBag(); var message = CreateTestMailMessage(); message.Subject.ReturnsForAnyArgs((string)null); mailBag.Add(message); var retrievedMessage = mailBag.All.First(); Assert.That(retrievedMessage, Is.SameAs(message)); }
public void TestAddThenGetByRecipient() { var mailBag = new MailBag(); var message = CreateTestMailMessage(); mailBag.Add(message); var retrievedMessage = mailBag.GetMailsWithRecipient(MailMessageData.FirstRecipient).First(); Assert.That(retrievedMessage, Is.SameAs(message)); Assert.That(mailBag.ContainsMailWithRecipient(MailMessageData.FirstRecipient)); retrievedMessage = mailBag.GetMailsWithRecipient(MailMessageData.SecondRecipient).First(); Assert.That(retrievedMessage, Is.SameAs(message)); Assert.That(mailBag.ContainsMailWithRecipient(MailMessageData.SecondRecipient)); }