An open API service indexing awesome lists of open source software.

https://github.com/verifytests/verify.sendgrid

Extends Verify to allow verification of SendGrid.
https://github.com/verifytests/verify.sendgrid

Last synced: 10 months ago
JSON representation

Extends Verify to allow verification of SendGrid.

Awesome Lists containing this project

README

          

# Verify.SendGrid

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/6jexhwrxrfbe9dsf?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-sendgrid)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.SendGrid.svg)](https://www.nuget.org/packages/Verify.SendGrid/)

Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of [SendGrid](https://github.com/sendgrid/sendgrid-csharp).

**See [Milestones](../../milestones?state=closed) for release notes.**

## Sponsors

### Entity Framework Extensions

[Entity Framework Extensions](https://entityframework-extensions.net/) is a major sponsor and is proud to contribute to the development this project.

[![Entity Framework Extensions](docs/zzz.png)](https://entityframework-extensions.net)

## NuGet

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

## Usage


```cs
[ModuleInitializer]
public static void Initialize() =>
VerifySendGrid.Initialize();
```
snippet source | anchor

### Attachment


```cs
[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:


```txt
{
Filename: name.txt,
Disposition: attachment,
Type: text/html,
Content: The content
}
```
snippet source | anchor

### SendGridMessage


```cs
[Fact]
public Task SendGridMessage()
{
var mail = new SendGridMessage
{
From = new("test@example.com", "DX Team"),
Subject = "Sending with Twilio SendGrid is Fun",
PlainTextContent = "and easy to do anywhere, even with C#",
HtmlContent = "and easy to do anywhere, even with C#"
};
mail.AddTo(new EmailAddress("test@example.com", "Test User"));
return Verify(mail);
}
```
snippet source | anchor

Results in:


```txt
{
From: DX Team ,
Personalizations: [
{
To: Test User
}
],
Subject: Sending with Twilio SendGrid is Fun,
PlainTextContent: and easy to do anywhere, even with C#,
HtmlContent: and easy to do anywhere, even with C#
}
```
snippet source | anchor

## Icon

[Grid](https://thenounproject.com/icon/grid-2082325/) from [The Noun Project](https://thenounproject.com).