-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tests.cs
110 lines (96 loc) · 2.4 KB
/
Tests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using SendGrid.Helpers.Mail;
public class Tests
{
#region 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);
}
#endregion
[Fact]
public Task AttachmentBinary()
{
var attachment = new Attachment
{
Filename = "name.txt",
Content = "The content",
Type = "application/vnd.ms-powerpoint",
Disposition = "attachment"
};
return Verify(attachment);
}
#region EmailAddress
[Fact]
public Task EmailAddress()
{
var address = new EmailAddress
{
Email = "joe.smith@example.com",
Name = "Joe Smith"
};
return Verify(address);
}
#endregion
#region Personalization
[Fact]
public Task Personalization()
{
var personalization = new Personalization
{
Subject = "The subject"
};
return Verify(personalization);
}
#endregion
#region SendGridMessage
[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 = "<strong>and easy to do anywhere, even with C#</strong>"
};
mail.AddTo(new EmailAddress("test@example.com", "Test User"));
return Verify(mail);
}
#endregion
[Fact]
public Task SingleReplyTo()
{
var mail = new SendGridMessage
{
ReplyTo = new("test@example.com", "DX Team"),
};
return Verify(mail);
}
[Fact]
public Task SingleReplyTos()
{
var mail = new SendGridMessage
{
ReplyTos = [new("test@example.com", "DX Team")],
};
return Verify(mail);
}
[Fact]
public Task SingleReplyToAndReplyTos()
{
var mail = new SendGridMessage
{
ReplyTos = [new("test@example.com", "DX Team")],
};
return Verify(mail);
}
}