Extends Verify to allow verification of SendGrid.
See Milestones for release notes.
https://nuget.org/packages/Verify.SendGrid/
[ModuleInitializer]
public static void Initialize() =>
VerifySendGrid.Initialize();
[Fact]
public Task Attachment()
{
var contentBytes = "The content"u8.ToArray();
var attachment = new Attachment
{
Filename = "name.txt",
Content = Convert.ToBase64String(contentBytes),
Type = "text/html",
Disposition = "attachment"
};
return Verify(attachment);
}
Results in:
{
Filename: name.txt,
Disposition: attachment,
Type: text/html,
Content: The content
}
[Fact]
public Task SendGridMessage()
{
var mail = new SendGridMessage
{
From = new("[email protected]", "DX Team"),
Subject = "Sending with Twilio SendGrid is Fun",
PlainTextContent = "and easy to do anywhere, even with C#",
HtmlContent = "<strong>and easy to do anywhere, even with C#</strong>"
};
mail.AddTo(new EmailAddress("[email protected]", "Test User"));
return Verify(mail);
}
Results in:
{
From: DX Team <[email protected]>,
Personalizations: [
{
To: Test User <[email protected]>
}
],
Subject: Sending with Twilio SendGrid is Fun,
PlainTextContent: and easy to do anywhere, even with C#,
HtmlContent: <strong>and easy to do anywhere, even with C#</strong>
}
Grid from The Noun Project.