Skip to content

Extends Verify to allow verification of SendGrid.

License

Notifications You must be signed in to change notification settings

VerifyTests/Verify.SendGrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.SendGrid

Discussions Build status NuGet Status

Extends Verify to allow verification of SendGrid.

See Milestones for release notes.

NuGet package

https://nuget.org/packages/Verify.SendGrid/

Usage

[ModuleInitializer]
public static void Initialize() =>
    VerifySendGrid.Initialize();

snippet source | anchor

Attachment

[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);
}

snippet source | anchor

Results in:

{
  Filename: name.txt,
  Disposition: attachment,
  Type: text/html,
  Content: The content
}

snippet source | anchor

SendGridMessage

[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);
}

snippet source | anchor

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>
}

snippet source | anchor

Icon

Grid from The Noun Project.

About

Extends Verify to allow verification of SendGrid.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Languages