コード例 #1
0
        public void ErrorMessage_If_From_Address_Is_Missing()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var actual = target.Send(new ElasticemailMessage());

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("sender address is missing"));
        }
コード例 #2
0
        public void ErrorMessage_If_From_Address_Is_Missing()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var actual = target.Send(new ElasticemailMessage());

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("sender address is missing"));
        }
コード例 #3
0
        public void GetDeliveryStatus_Invalid_TransactionIdXml()
        {
            var target = new ElasticemailWebApi(_apiKey);

            var actual = target.GetDeliveryStatusXml(Guid.Parse("f088b2e9-5412-47f2-9cec-225b71ee6672"));

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.AreEqual("No job with transactionId f088b2e9-5412-47f2-9cec-225b71ee6672 could be found.", actual.ErrorMessage);
        }
コード例 #4
0
        public void GetDeliveryStatus_Invalid_TransactionId()
        {
            var target = new ElasticemailWebApi(_apiKey);

            var actual = target.GetDeliveryStatus(Guid.Parse("53b12541-1234-49b3-b57a-dd64e09cde5f"));

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.AreEqual("No job with transactionId 53b12541-1234-49b3-b57a-dd64e09cde5f could be found.", actual.ErrorMessage);
        }
コード例 #5
0
        public void ErrorMessage_If_To_Address_Is_Missing()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var mail = new ElasticemailMessage();
            mail.From = new MailAddress("*****@*****.**", "John");
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("recipient address is missing"));
        }
コード例 #6
0
        public void ErrorMessage_If_To_Address_Is_Missing()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var mail   = new ElasticemailMessage();

            mail.From = new MailAddress("*****@*****.**", "John");
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("recipient address is missing"));
        }
コード例 #7
0
        public void SendUnauthorized()
        {
            var target = new ElasticemailWebApi("invalidApiKey");
            var mail = new ElasticemailMessage();
            mail.From = new MailAddress("*****@*****.**", "John");
            mail.To.Add(new MailAddress("*****@*****.**", "Anna"));
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("Unauthorized"));
        }
コード例 #8
0
        public void GetDeliveryStatus_Valid_TransactionIdXml()
        {
            Guid id     = Guid.Parse("f088b2e9-5412-47f2-9cec-225b71ee667c");
            var  target = new ElasticemailWebApi(_apiKey);

            var actual = target.GetDeliveryStatusXml(id);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.AreEqual(id, actual.DeliveryStatus.Id);
            Assert.AreEqual(1, actual.DeliveryStatus.Delivered);
            Assert.AreEqual("complete", actual.DeliveryStatus.Status);
        }
コード例 #9
0
        public void GetDeliveryStatus_Valid_TransactionId()
        {
            Guid id = Guid.Parse("53b12541-210e-49b3-b57a-dd64e09cde5f");
            var target = new ElasticemailWebApi(_apiKey);

            var actual = target.GetDeliveryStatus(id);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.AreEqual(id, actual.DeliveryStatus.Id);
            Assert.AreEqual(1, actual.DeliveryStatus.Delivered);
            Assert.AreEqual("complete", actual.DeliveryStatus.Status);
        }
コード例 #10
0
        public void SendUnauthorized()
        {
            var target = new ElasticemailWebApi("invalidApiKey");
            var mail   = new ElasticemailMessage();

            mail.From = new MailAddress("*****@*****.**", "John");
            mail.To.Add(new MailAddress("*****@*****.**", "Anna"));
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("Unauthorized"));
        }
コード例 #11
0
        public void SendUnauthorized()
        {
            var target = new ElasticemailWebApi("invalidApiKey");
            var mail   = new ElasticemailMessage();

            mail.From = new MailAddress("*****@*****.**", "John");
            mail.To.Add(new MailAddress("*****@*****.**", "Anna"));
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.IsTrue(actual.ErrorMessage.Contains("Unauthorized"));
        }
コード例 #12
0
        public void GetDeliveryStatus_Valid_TransactionId()
        {
            Guid id     = Guid.Parse("53b12541-210e-49b3-b57a-dd64e09cde5f");
            var  target = new ElasticemailWebApi(_apiKey);

            var actual = target.GetDeliveryStatus(id);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.AreEqual(id, actual.DeliveryStatus.Id);
            Assert.AreEqual(1, actual.DeliveryStatus.Delivered);
            Assert.AreEqual("complete", actual.DeliveryStatus.Status);
        }
コード例 #13
0
        public void Send_Email_Returns_TransactionId()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var mail = new ElasticemailMessage();
            mail.To.Add(new MailAddress("*****@*****.**"));
            mail.From = new MailAddress("*****@*****.**", "Marc");
            mail.ReplyTo = new MailAddress("*****@*****.**", "Marc");
            mail.Subject = "Test";
            mail.Body = "Body";
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.IsNotNull(actual.TransactionId);
        }
コード例 #14
0
        public void Send_Email_Returns_TransactionId()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var mail   = new ElasticemailMessage();

            mail.To.Add(new MailAddress("*****@*****.**"));
            mail.From    = new MailAddress("*****@*****.**", "Marc");
            mail.ReplyTo = new MailAddress("*****@*****.**", "Marc");
            mail.Subject = "Test";
            mail.Body    = "Body";
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.IsNotNull(actual.TransactionId);
        }
コード例 #15
0
        public void Send_Email_With_Attachment()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var mail = new ElasticemailMessage();
            mail.To.Add(new MailAddress("*****@*****.**", "Marc"));
            mail.From = new MailAddress("*****@*****.**", "Marc");
            mail.ReplyTo = new MailAddress("*****@*****.**", "Marc");
            mail.Subject = "Test";
            mail.Body = "Body";
            mail.AddAttachment("file.txt", new byte[100]);
            mail.AddAttachment("file2.txt", new byte[200]);
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.IsNotNull(actual.TransactionId);
        }
コード例 #16
0
        public void Send_Email_With_Attachment()
        {
            var target = new ElasticemailWebApi(_apiKey);
            var mail   = new ElasticemailMessage();

            mail.To.Add(new MailAddress("*****@*****.**", "Marc"));
            mail.From    = new MailAddress("*****@*****.**", "Marc");
            mail.ReplyTo = new MailAddress("*****@*****.**", "Marc");
            mail.Subject = "Test";
            mail.Body    = "Body";
            mail.AddAttachment("file.txt", new byte[100]);
            mail.AddAttachment("file2.txt", new byte[200]);
            var actual = target.Send(mail);

            Assert.AreEqual(ResultType.Success, actual.ResultType);
            Assert.IsNotNull(actual.TransactionId);
        }
コード例 #17
0
        public void GetDeliveryStatus_Invalid_TransactionId()
        {
            var target = new ElasticemailWebApi(_apiKey);

            var actual = target.GetDeliveryStatus(Guid.Parse("53b12541-1234-49b3-b57a-dd64e09cde5f"));

            Assert.AreEqual(ResultType.Error, actual.ResultType);
            Assert.AreEqual("No job with transactionId 53b12541-1234-49b3-b57a-dd64e09cde5f could be found.", actual.ErrorMessage);
        }