public void AsMimeMessage_NullSubject_SetsSubjectToEmptyString()
        {
            var emailMessage = new EmailMessage
            {
                Sender = new EmailAddress {
                    Address = "*****@*****.**"
                },
                Recipient = new EmailAddress {
                    Address = "*****@*****.**"
                }
            };

            var mimeMessage = emailMessage.AsMimeMessage(string.Empty);

            mimeMessage.Should().BeOfType <MimeMessage>();
            mimeMessage.Subject.Should().Be(string.Empty);
        }
        public void AsMimeMessage_ReturnsExpectedValuesWithPrefix()
        {
            const string recipient          = "*****@*****.**";
            const string sender             = "*****@*****.**";
            const string subject            = "Subject";
            const string htmlBody           = "HTML";
            const string textBody           = "Text";
            const string emailSubjectPrefix = "Prefix";

            var emailMessage = new EmailMessage
            {
                Sender = new EmailAddress {
                    Address = sender
                },
                Recipient = new EmailAddress {
                    Address = recipient
                },
                Subject  = subject,
                HtmlBody = "HTML",
                TextBody = "Text",
            };

            var mimeMessage = emailMessage.AsMimeMessage(emailSubjectPrefix);

            mimeMessage.Should().BeOfType <MimeMessage>();

            IEnumerable <InternetAddress> from = mimeMessage.From;

            from.Should().HaveCount(1);
            from.First().As <MailboxAddress>().Address.Should().Be(sender);

            IEnumerable <InternetAddress> to = mimeMessage.To;

            to.Should().HaveCount(1);
            to.First().As <MailboxAddress>().Address.Should().Be(recipient);

            mimeMessage.Subject.Should().Be($"{emailSubjectPrefix} {subject}");
            mimeMessage.HtmlBody.Should().Be(htmlBody);
            mimeMessage.TextBody.Should().Be(textBody);
        }