示例#1
0
        public async void SendgridFailTest()
        {
            var       sendgridClient = new SendgridDeliveryService(apikey: "0x000", httpClient: new TestHttpClient(HttpStatusCode.BadRequest, ""));
            IPostbode postbode       = new PostbodeClient();

            postbode =
                postbode.Use(sendgridClient)
                .SetRecipient("*****@*****.**")
                .SetSender("*****@*****.**")
                .SetSubject("test")
                .SetTextContent("HALLLOOOO");

            postbode.Mail.Headers = new Dictionary <string, string>()
            {
                { "test-key", "test-value" }
            };

            var result = await postbode.SendAsync();

            Assert.False(result.Succes);
        }
示例#2
0
        public async void MailgunTest()
        {
            var       mailgunClient = new MailgunDeliveryService(domain: "test.nl", apikey: "0x000", httpClient: new TestHttpClient(HttpStatusCode.OK, ""));
            IPostbode postbode      = new PostbodeClient();

            postbode =
                postbode.Use(mailgunClient)
                .SetRecipient("*****@*****.**")
                .SetSender("*****@*****.**")
                .SetSubject("test")
                .SetTextContent("HALLLOOOO");

            postbode.Mail.Headers = new Dictionary <string, string>()
            {
                { "test-key", "test-value" }
            };

            var result = await postbode.SendAsync();

            Assert.True(result.Succes);
        }
示例#3
0
 public async void TestSmtpDelivery()
 {
     var postbode = new PostbodeClient().SetSender("*****@*****.**").SetRecipient("*****@*****.**", type: RecipientType.Cc)
                    .SetTextContent("test").Use(new SmtpDeliveryService());
     await Assert.ThrowsAsync <NotImplementedException>(() => postbode.SendAsync());
 }