summaryrefslogtreecommitdiffstats
path: root/SendGrid/Tests/TestUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SendGrid/Tests/TestUtils.cs')
-rwxr-xr-xSendGrid/Tests/TestUtils.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/SendGrid/Tests/TestUtils.cs b/SendGrid/Tests/TestUtils.cs
new file mode 100755
index 0000000..48febcf
--- /dev/null
+++ b/SendGrid/Tests/TestUtils.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using SendGridMail;
+
+namespace Tests
+{
+ [TestFixture]
+ public class TestUtils
+ {
+ [Test]
+ public void TestSerialize()
+ {
+ var testcase = "foo";
+ String result = Utils.Serialize(testcase);
+ Assert.AreEqual("\"foo\"", result);
+
+ var testcase2 = 1;
+ result = Utils.Serialize(testcase2);
+ Assert.AreEqual("1", result);
+ }
+
+ [Test]
+ public void TestSerializeDictionary()
+ {
+ var test = new Dictionary<string, string>
+ {
+ {"a", "b"},
+ {"c", "d/e"}
+ };
+ var result = Utils.SerializeDictionary(test);
+ var expected = "{\"a\":\"b\",\"c\":\"d\\/e\"}";
+ Assert.AreEqual(expected, result);
+ }
+ }
+}