blob: 48febcf2795f9855ddafc2557d82fe7783438ecc (
plain)
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
|
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);
}
}
}
|