diff options
author | Brandon West <brawest@gmail.com> | 2015-04-21 17:05:25 -0600 |
---|---|---|
committer | Brandon West <brawest@gmail.com> | 2015-04-21 17:05:25 -0600 |
commit | cd5b5a8733bc2c82b4205757766a21da2f0551c5 (patch) | |
tree | e4a6329edf13c1d44c3e0bfaf2b5796cb2a51d96 /SendGrid | |
parent | f0b713340211c2f5f7bc3b7e0e48559a88cb9212 (diff) | |
parent | f251c6fbd178d21fef5a4c14465647abd53e7f57 (diff) | |
download | sendgrid-csharp-cd5b5a8733bc2c82b4205757766a21da2f0551c5.zip sendgrid-csharp-cd5b5a8733bc2c82b4205757766a21da2f0551c5.tar.gz sendgrid-csharp-cd5b5a8733bc2c82b4205757766a21da2f0551c5.tar.bz2 |
merge
Diffstat (limited to 'SendGrid')
-rw-r--r-- | SendGrid/Example/Program.cs | 5 | ||||
-rw-r--r-- | SendGrid/SendGridMail/SendGrid.cs | 5 | ||||
-rw-r--r-- | SendGrid/Tests/TestSendgrid.cs | 14 |
3 files changed, 20 insertions, 4 deletions
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs index a62d434..113e3f5 100644 --- a/SendGrid/Example/Program.cs +++ b/SendGrid/Example/Program.cs @@ -18,8 +18,9 @@ namespace Example myMessage.Subject = "Testing the SendGrid Library";
myMessage.Text = "Hello World! %tag%";
- var subs = new List<String> { "私はラーメンが大好き" };
- myMessage.AddSubstitution("%tag%",subs);
+ var subs = new List<String> { "私は%type%ラーメンが大好き" };
+ myMessage.AddSubstitution("%tag%",subs);
+ myMessage.AddSection("%type%", "とんこつ");
SendAsync(myMessage);
diff --git a/SendGrid/SendGridMail/SendGrid.cs b/SendGrid/SendGridMail/SendGrid.cs index 1e63005..e4e0d22 100644 --- a/SendGrid/SendGridMail/SendGrid.cs +++ b/SendGrid/SendGridMail/SendGrid.cs @@ -234,6 +234,11 @@ namespace SendGrid Header.AddSubstitution(replacementTag, substitutionValues);
}
+ public void AddSection(String relacementTag, String sectionValue)
+ {
+ Header.AddSection(relacementTag, sectionValue);
+ }
+
public void AddUniqueArgs(IDictionary<String, String> identifiers)
{
Header.AddUniqueArgs(identifiers);
diff --git a/SendGrid/Tests/TestSendgrid.cs b/SendGrid/Tests/TestSendgrid.cs index 5d7bee4..37a9990 100644 --- a/SendGrid/Tests/TestSendgrid.cs +++ b/SendGrid/Tests/TestSendgrid.cs @@ -346,6 +346,17 @@ namespace Tests var json = header.JsonString();
Assert.AreEqual("{\"filters\" : {\"opentrack\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
}
+ [Test]
+ public void TestAddSection()
+ {
+ var header = new Header();
+ var sendgrid = new SendGridMessage(header);
+
+ sendgrid.AddSection("tag", "value");
+
+ var json = header.JsonString();
+ Assert.AreEqual("{\"section\" : {\"tag\" : \"value\"}}", json);
+ }
[Test]
public void TestSendToSink()
@@ -397,5 +408,4 @@ namespace Tests Assert.AreEqual("foo1@bar1.com", message.To[1].Address);
Assert.AreEqual("", message.To[1].DisplayName);
}
- }
-}
\ No newline at end of file +}
|