private void AssertMessage(IDummyMailMessage receivedMessage_, MailMessage sentMessage_)
 {
     Assert.That(receivedMessage_.Sender, Is.EqualTo(sentMessage_.From));
     Assert.That(receivedMessage_.Subject, Is.EqualTo(sentMessage_.Subject));
     Assert.That(receivedMessage_.Body, Is.Not.Null, "No message body found");
     Assert.That(receivedMessage_.Body.Contains(sentMessage_.Body), "The message body does not match"); // Need to test as contains as the .NET classes seem to add a trailing CRLF
     Assert.That(receivedMessage_.Recipients.Count(), Is.EqualTo(2));
     Assert.That(receivedMessage_.WasSentTo(sentMessage_.To[0].Address));
     Assert.That(receivedMessage_.WasSentTo(sentMessage_.To[1].Address));
 }
Beispiel #2
0
 /// <summary>
 /// See <code>IMailBag.Add</code>
 /// </summary>
 /// <param name="message_"></param>
 public void Add(IDummyMailMessage message_)
 {
     lock (_lock)
     {
         _all.Add(message_);
         _bySender.Add(message_.Sender, message_);
         _bySubject.Add(message_.Subject ?? NullSubject, message_);
         foreach (var recipient in message_.Recipients)
         {
             _byRecipient.Add(recipient, message_);
         }
     }
 }
Beispiel #3
0
        /// <summary>
        /// Add the specified mail message to this dictionary against the specified key.
        /// If the key provided already exists then override the current contents with the
        /// new dictionary.
        /// </summary>
        /// <param name="key_">The key to store the mail message against</param>
        /// <param name="message_">The mail message to store</param>
        public void Add(string key_, IDummyMailMessage message_)
        {
            List <IDummyMailMessage> messages;

            if (_data.ContainsKey(key_))
            {
                messages = _data[key_];
            }
            else
            {
                messages = new List <IDummyMailMessage>();
                _data.Add(key_, messages);
            }
            messages.Add(message_);
        }