Skip to content

Commit 931545d

Browse files
Update test to match Hello World in README
1 parent b28a971 commit 931545d

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

tests/SendGrid.Tests/Integration.cs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Xunit;
1212
using System.Threading;
1313
using System.Text;
14+
using Xunit.Abstractions;
1415

1516
public class IntegrationFixture : IDisposable
1617
{
@@ -55,10 +56,12 @@ public void Dispose()
5556
public class Integration : IClassFixture<IntegrationFixture>
5657
{
5758
IntegrationFixture fixture;
59+
private readonly ITestOutputHelper output;
5860

59-
public Integration(IntegrationFixture fixture)
61+
public Integration(IntegrationFixture fixture, ITestOutputHelper output)
6062
{
6163
this.fixture = fixture;
64+
this.output = output;
6265
}
6366

6467
// Base case for sending a single email
@@ -73,21 +76,6 @@ public void TestSendSingleEmailWithHelper()
7376
msg.AddContent(MimeType.Html, "HTML content");
7477
Assert.True(msg.Serialize() == "{\"from\":{\"email\":\"[email protected]\"},\"personalizations\":[{\"to\":[{\"email\":\"[email protected]\"}],\"subject\":\"Hello World from the SendGrid CSharp Library\"}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"HTML content\"}]}");
7578

76-
msg = new SendGridMessage();
77-
msg.SetFrom(new EmailAddress("[email protected]"));
78-
msg.AddTo(new EmailAddress("[email protected]"));
79-
msg.SetSubject("Hello World from the SendGrid CSharp Library");
80-
msg.AddContent(MimeType.Html, "HTML content");
81-
Console.WriteLine(msg.Serialize());
82-
83-
msg = new SendGridMessage();
84-
msg.SetFrom("[email protected]");
85-
msg.AddTo("[email protected]");
86-
msg.SetSubject("Hello World from the SendGrid CSharp Library");
87-
msg.AddContent(MimeType.Text, "Textual content");
88-
msg.AddContent(MimeType.Html, "HTML content");
89-
Assert.True(msg.Serialize() == "{\"from\":{\"email\":\"[email protected]\"},\"personalizations\":[{\"to\":[{\"email\":\"[email protected]\"}],\"subject\":\"Hello World from the SendGrid CSharp Library\"}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"HTML content\"}]}");
90-
9179
// Test Hello World Example
9280
var from = new EmailAddress("[email protected]", "Example User");
9381
var subject = "Sending with SendGrid is Fun";
@@ -96,9 +84,9 @@ public void TestSendSingleEmailWithHelper()
9684
var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";
9785
msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
9886

99-
Console.WriteLine(msg.Serialize());
87+
output.WriteLine(msg.Serialize());
10088

101-
Assert.True(msg.Serialize() == "{\"from\":{\"name\":\"Example User\",\"email\":\"[email protected]\"},\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"[email protected]\"}],\"subject\":\"Sending with SendGrid is Fun\"}],\"content\":[{\"type\":\"text/plain\",\"value\":\"and easy to do anywhere, even with C#\"},{\"type\":\"text/html\",\"value\":\"<strong>and easy to do anywhere, even with C#</strong>\"}]}");
89+
Assert.True(msg.Serialize() == "{\"from\":{\"name\":\"Example User\",\"email\":\"[email protected]\"},\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"[email protected]\"}],\"subject\":\"Sending with SendGrid is Fun\"}],\"content\":[{\"type\":\"text/plain\",\"value\":\"and easy to do anywhere, even with C#\"},{\"type\":\"text/html\",\"value\":\"\\u003cstrong\\u003eand easy to do anywhere, even with C#\\u003c/strong\\u003e\"}]}");
10290
}
10391

10492
[Fact]

0 commit comments

Comments
 (0)