summaryrefslogtreecommitdiffstats
path: root/SendGrid
diff options
context:
space:
mode:
authorBrandon West <brawest@gmail.com>2015-04-21 17:05:25 -0600
committerBrandon West <brawest@gmail.com>2015-04-21 17:05:25 -0600
commitcd5b5a8733bc2c82b4205757766a21da2f0551c5 (patch)
treee4a6329edf13c1d44c3e0bfaf2b5796cb2a51d96 /SendGrid
parentf0b713340211c2f5f7bc3b7e0e48559a88cb9212 (diff)
parentf251c6fbd178d21fef5a4c14465647abd53e7f57 (diff)
downloadsendgrid-csharp-cd5b5a8733bc2c82b4205757766a21da2f0551c5.zip
sendgrid-csharp-cd5b5a8733bc2c82b4205757766a21da2f0551c5.tar.gz
sendgrid-csharp-cd5b5a8733bc2c82b4205757766a21da2f0551c5.tar.bz2
merge
Diffstat (limited to 'SendGrid')
-rw-r--r--SendGrid/Example/Program.cs5
-rw-r--r--SendGrid/SendGridMail/SendGrid.cs5
-rw-r--r--SendGrid/Tests/TestSendgrid.cs14
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
+}