public void SendMail_MailMessageNullResult_BodySaysNoFiles() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); ZipResult result = null; string subject = "this is the subject"; mailer.SendZip(result, emailAddress, emailAddress, subject, this.attachmentName); var mailMessage = mailService.MailMessage; Assert.IsTrue(mailMessage.Body.Contains("No files found for range specified")); }
public void SendMail_MailMessageCorrectEmailTo() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); ZipResult result = new ZipResult() { Entries = new string[0], ZipStream = new MemoryStream() }; string emailAddressto = "*****@*****.**"; string subject = "this is the subject"; mailer.SendZip(result, emailAddressto, emailAddress, subject, this.attachmentName); Assert.AreEqual(emailAddressto, mailService.MailMessage.To.First().Address); }
public void SendMail_MailMessageFileAttached() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); ZipResult result = new ZipResult() { Entries = new string[0], ZipStream = new MemoryStream() }; string subject = "this is the subject"; mailer.SendZip(result, emailAddress, emailAddress, subject, this.attachmentName); var attachmentCollection = mailService.MailMessage.Attachments; Assert.AreEqual(1, attachmentCollection.Count); }
public void SendMail_MailMessageNoStream_NoAttachment() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); ZipResult result = new ZipResult() { Entries = new string[0], ZipStream = null }; string subject = "this is the subject"; mailer.SendZip(result, emailAddress, emailAddress, subject, this.attachmentName); var mailMessage = mailService.MailMessage; Assert.IsEmpty(mailMessage.Attachments, "Shouldn't be any attachments"); }
public void SendMail_MailMessageMessageBodySet() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); var thisisoneTxt = "thisisone.txt"; ZipResult result = new ZipResult() { Entries = new[] { thisisoneTxt }, ZipStream = new MemoryStream() }; string subject = "this is the subject"; mailer.SendZip(result, emailAddress, emailAddress, subject, this.attachmentName); var body = mailService.MailMessage.Body; Assert.IsTrue(body.Contains(thisisoneTxt), "Message body does not contain the entry " + thisisoneTxt); }
public void SendMail_MailMessageCorrectSubject() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); var memoryStream = new MemoryStream(); ZipResult result = new ZipResult() { Entries = new string[0], ZipStream = memoryStream }; string subject = "this is the subject"; mailer.SendZip(result, emailAddress, emailAddress, subject, this.attachmentName); var mailMessage = mailService.MailMessage; Assert.AreEqual(subject, mailMessage.Subject); }
public void SendMail_MailMessageCorrectFileAttached() { MailServiceStub mailService = new MailServiceStub(); Mailer mailer = new Mailer(mailService); var memoryStream = new MemoryStream(); ZipResult result = new ZipResult() { Entries = new string[0], ZipStream = memoryStream }; string subject = "this is the subject"; mailer.SendZip(result, emailAddress, emailAddress, subject, this.attachmentName); var attachmentCollection = mailService.MailMessage.Attachments; Assert.AreSame(memoryStream, attachmentCollection.First().ContentStream); }