-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shorter method names in (I)EmailComposer (#19)
* Remove Set prefix from IEmailComposer methods * Update readme * Bump example packages
- Loading branch information
Showing
28 changed files
with
185 additions
and
854 deletions.
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,14 +78,13 @@ public async Task SendConfirmationMail(string customerMail, string customerName) | |
new AppDirectoryTemplateProvider("Templates", ".sbnhtml"), | ||
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetModel(new TestMailModel { Email = customerMail, Name = customerMail }) | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Build(); | ||
EmailRequest request = await composer | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.Build(new TestMailModel { Email = customerMail, Name = customerMail }); | ||
|
||
EmailRequest populatedRequest = await builder.BuildAsync(request); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,11 +79,11 @@ public async Task SendConfirmationMail(string customerMail, string customerName) | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail }); | ||
|
||
SmtpCredentials credentials = new("smtp.gmail.com", "587", "false", "true", "[email protected]", "mypassword"); | ||
|
@@ -98,11 +98,11 @@ If you use DI, you can just use `IMailer` and use the overload that exposes the | |
public async Task SendConfirmationMail(string customerMail, string customerName) | ||
{ | ||
await mailer.SendMailAsync(x => x | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail })); | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,9 @@ public async Task ServiceCollection_Defaults_ShouldConstructAndSendMail() | |
ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider(); | ||
IMailer mailer = serviceProvider.GetService<IMailer>(); | ||
//await mailer.SendMailAsync(x => x | ||
//.SetSubject("Hello world") | ||
//.SetFrom("[email protected]") | ||
//.SetTo("[email protected]") | ||
//.Subject("Hello world") | ||
//.From("[email protected]") | ||
//.To("[email protected]") | ||
//.BuildAsync(new TestMailModel { Email = "[email protected]", Name = "Guy Gadbois" })); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,11 +80,11 @@ public async Task SendConfirmationMail(string customerMail, string customerName) | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail }); | ||
|
||
SmtpCredentials credentials = new("smtp.gmail.com", "587", "false", "true", "[email protected]", "mypassword"); | ||
|
@@ -99,11 +99,11 @@ If you use DI, you can just use `IMailer` and use the overload that exposes the | |
public async Task SendConfirmationMail(string customerMail, string customerName) | ||
{ | ||
await mailer.SendMailAsync(x => x | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail })); | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,9 @@ public async Task Graph_SendMail_ShouldSend() | |
|
||
EmailComposer composer = new(); | ||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = "[email protected]", Name = "Guy Gadbois" }); | ||
|
||
Mock<IMailer> mock = new(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,11 +79,11 @@ public async Task SendConfirmationMail(string customerMail, string customerName) | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail }); | ||
|
||
SmtpCredentials credentials = new("smtp.gmail.com", "587", "false", "true", "[email protected]", "mypassword"); | ||
|
@@ -98,11 +98,11 @@ If you use DI, you can just use `IMailer` and use the overload that exposes the | |
public async Task SendConfirmationMail(string customerMail, string customerName) | ||
{ | ||
await mailer.SendMailAsync(x => x | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail })); | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,11 +79,11 @@ public async Task SendConfirmationMail(string customerMail, string customerName) | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail }); | ||
|
||
SmtpCredentials credentials = new("smtp.gmail.com", "587", "false", "true", "[email protected]", "mypassword"); | ||
|
@@ -98,11 +98,11 @@ If you use DI, you can just use `IMailer` and use the overload that exposes the | |
public async Task SendConfirmationMail(string customerMail, string customerName) | ||
{ | ||
await mailer.SendMailAsync(x => x | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail })); | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,9 @@ public void Sendgrid_SendMail_KeyIsNull_ShouldThrowException() | |
{ | ||
EmailComposer composer = new(); | ||
EmailRequest request = composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Build(); | ||
|
||
Assert.ThrowsException<ArgumentNullException>(() => new SendGridMailer(null)); | ||
|
@@ -27,9 +27,9 @@ public void Sendgrid_SendMail_KeyIsEmpty_ShouldThrowException() | |
{ | ||
EmailComposer composer = new(); | ||
EmailRequest request = composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Build(); | ||
|
||
Assert.ThrowsException<ArgumentNullException>(() => new SendGridMailer("")); | ||
|
@@ -40,9 +40,9 @@ public void Sendgrid_SendMail_KeyIsNotEmpty_ShouldConstruct() | |
{ | ||
EmailComposer composer = new(); | ||
EmailRequest request = composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Build(); | ||
|
||
IMailer mailer = new SendGridMailer("MySGKey"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,11 +80,11 @@ public async Task SendConfirmationMail(string customerMail, string customerName) | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail }); | ||
|
||
SmtpCredentials credentials = new("smtp.gmail.com", "587", "false", "true", "[email protected]", "mypassword"); | ||
|
@@ -99,11 +99,11 @@ If you use DI, you can just use `IMailer` and use the overload that exposes the | |
public async Task SendConfirmationMail(string customerMail, string customerName) | ||
{ | ||
await mailer.SendMailAsync(x => x | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = customerMail, Name = customerMail })); | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,11 @@ public async Task Smtp_SendTemplateMail_ShouldSend() | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]", "Facteur") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]", "Facteur") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = "[email protected]", Name = "Guy Gadbois" }); | ||
|
||
IMailer mailer = new SmtpMailer(credentials); | ||
|
@@ -46,11 +46,11 @@ public async Task Smtp_SendTemplateMail_SimulateDependencyInjection_ShouldSend() | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.BuildAsync(new TestMailModel { Email = "[email protected]", Name = "Guy Gadbois" }); | ||
|
||
IMailer mailer = new SmtpMailer(credentials); | ||
|
@@ -84,11 +84,11 @@ public async Task Smtp_SendTemplateMail_WithAttachments_ShouldSend() | |
new ViewModelTemplateResolver()); | ||
|
||
EmailRequest request = await composer | ||
.SetSubject("Hello world") | ||
.SetFrom("[email protected]") | ||
.SetTo("[email protected]") | ||
.SetCc("[email protected]") | ||
.SetBcc("[email protected]") | ||
.Subject("Hello world") | ||
.From("[email protected]") | ||
.To("[email protected]") | ||
.Cc("[email protected]") | ||
.Bcc("[email protected]") | ||
.Attach(attachments) | ||
.BuildAsync(new TestMailModel { Email = "[email protected]", Name = "Guy Gadbois" }); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.