Esempio n. 1
0
        public void TestAddThenCount()
        {
            var mailBag = new MailBag();
            var message = CreateTestMailMessage();

            mailBag.Add(message);
            Assert.That(mailBag.Count, Is.EqualTo(1));
        }
Esempio n. 2
0
        public void TestAddThenGetAll()
        {
            var mailBag = new MailBag();
            var message = CreateTestMailMessage();

            mailBag.Add(message);
            var retrievedMessage = mailBag.All.First();

            Assert.That(retrievedMessage, Is.SameAs(message));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        private MailBag CreatePopulatedMailBag()
        {
            var mailBag = new MailBag();

            for (int index = 0; index < MailMessageData.AlternativeRecipients.Length; index++)
            {
                mailBag.Add(CreateTestMailMessage(index));
            }

            return(mailBag);
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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));
        }