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.
- Host: GitHub
- URL: https://github.com/verifytests/verify.sendgrid
- Owner: VerifyTests
- License: mit
- Created: 2023-03-31T07:57:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-08-29T11:24:31.000Z (10 months ago)
- Last Synced: 2025-08-29T14:57:14.706Z (10 months ago)
- Language: C#
- Homepage:
- Size: 338 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
#
Verify.SendGrid
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/verify-sendgrid)
[](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.
[](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).