[TestFixture] public class EmailMailMessageFactoryTests { private EmailNotification _emailNotification;
[TestFixture]
public class EmailMailMessageFactoryTests
{
private EmailNotification _emailNotification;
[SetUp]
public void SetUp()
{
_emailNotification = new EmailNotification("[email protected]", "[email protected];[email protected]", "subject", "body", true)
{
AttachmentsPaths = new List<string> { "1", "2" },
CC = "[email protected]",
BCC = "[email protected]"
};
}
[Test]
public void CreateMailMessage_WhenCalled_CreatesMailMessage()
{
var emailMailMessageFactory = new EmailMailMessageFactory("[email protected]");
var result = emailMailMessageFactory.CreateMailMessage(_emailNotification);
Assert.That(result.From.Address, Is.EqualTo(_emailNotification.From));
Assert.That(result.To[0].Address, Is.EqualTo(_emailNotification.To));
Assert.That(result.Subject, Is.EqualTo(_emailNotification.Subject));
Assert.That(result.Body, Is.EqualTo(_emailNotification.Body));
Assert.That(result.IsBodyHtml, Is.EqualTo(_emailNotification.IsBodyHtml));
Assert.That(result.Attachments.Count, Is.EqualTo(_emailNotification.AttachmentsPaths.Count));
//this assert fails "FileNotFoundException"
Assert.That(result.CC[0].Address, Is.EqualTo(_emailNotification.CC));
Assert.That(result.Bcc[0].Address, Is.EqualTo(_emailNotification.BCC));
}