Example #1
0
        public Email(string subject, string content, string contentType, EmailAddress from)
        {
            Subject = subject;
            Content = content;
            ContentType = contentType;
            From = from;

            To = new List<EmailAddress>();
            Cc = new List<EmailAddress>();
            Bcc = new List<EmailAddress>();
            Headers = new List<string>();
        }
Example #2
0
 public void CreateEmailTest()
 {
     //Arrange
     const string content = "content";
     const string contentType = "contentType";
     const string subject = "subject";
     var from = new EmailAddress();
     
     //Act
     var email = new Email(subject, content, contentType, from);
     
     //Assert
     Assert.IsNotNull(email.To);
     Assert.IsNotNull(email.Cc);
     Assert.IsNotNull(email.Bcc);
     Assert.AreEqual(subject,email.Subject);
     Assert.AreEqual(content, email.Content);
     Assert.AreEqual(contentType, email.ContentType);
     Assert.AreEqual(from, email.From);
 }
 public void AddBccRecipient(EmailAddress emailAddress)
 {
     _mailMessage.Bcc.Add(new MailAddress(emailAddress.Address, emailAddress.DisplayName, Encoding.UTF8));
 }
 public void SetSender(EmailAddress emailAddress)
 {
     _mailMessage.From = new MailAddress(emailAddress.Address, emailAddress.DisplayName, Encoding.UTF8);
 }
        public void InitializeSenderTest()
        {
            //Arrange
            var sender = new EmailAddress();

            _email.Setup(p => p.From).Returns(sender);

            //Act
            _emailInitializer.Initialize(_emailBuilder.Object, _email.Object);

            //Assert
           _emailBuilder.Verify(m=>m.SetSender(sender));
        }