public void DefaultFromTest() { var options = Options.Create(new PostbodeOptions() { DefaultFromAddress = "*****@*****.**", DefaultFromName = "test" }); var postbode = new PostbodeClient(options); Assert.Equal(postbode.Mail.From.Email, options.Value.DefaultFromAddress); Assert.Equal(postbode.Mail.From.Name, options.Value.DefaultFromName); }
public void RecipientTest() { var postbode = new PostbodeClient() .SetRecipients(new IRecipient[] { new Recipient("*****@*****.**", "test"), new Recipient("*****@*****.**", "test2") }, RecipientType.To) .SetRecipients(new IRecipient[] { new Recipient("*****@*****.**", "test"), new Recipient("*****@*****.**", "test2") }, RecipientType.Cc) .SetRecipients(new IRecipient[] { new Recipient("*****@*****.**", "test"), new Recipient("*****@*****.**", "test2") }, RecipientType.Bcc); Assert.Equal(2, postbode.Mail.To.Length); Assert.Equal(2, postbode.Mail.Cc.Length); Assert.Equal(2, postbode.Mail.Bcc.Length); }
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); }
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); }
public void SendgridNameTest() { var client = new PostbodeClient().UseSendgrid(); Assert.Equal(client.DeliveryService.Name.ToLowerInvariant(), "sendgrid"); }
public void TestHtmlContent() { var response = new PostbodeClient().SetHtmlContent("<h1>Test</h1>"); Assert.Equal("text/html", response.Mail.Content.Type); }
public void SmtpNameTest() { var client = new PostbodeClient().UseSmtp(); Assert.Equal(client.DeliveryService.Name.ToLowerInvariant(), "system.net.smtp"); }
public async void TestSmtpDelivery() { var postbode = new PostbodeClient().SetSender("*****@*****.**").SetRecipient("*****@*****.**", type: RecipientType.Cc) .SetTextContent("test").Use(new SmtpDeliveryService()); await Assert.ThrowsAsync <NotImplementedException>(() => postbode.SendAsync()); }
public void MailgunNameTest() { var client = new PostbodeClient().UseMailgun(); Assert.Equal(client.DeliveryService.Name.ToLowerInvariant(), "mailgun"); }