예제 #1
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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"));
        }
예제 #2
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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);
        }
예제 #3
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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);
        }
예제 #4
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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");
        }
예제 #5
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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);
        }
예제 #6
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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);
        }
예제 #7
0
파일: MailerTests.cs 프로젝트: deeja/Pigeon
        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);
        }