diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-10 21:32:45 -0800 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-10 21:32:45 -0800 |
commit | 7002bfc825ea9904af7811a84740e001fbb34e0c (patch) | |
tree | 9279309173a9832fae2623fbc7145ec871834d93 /SendGrid/UnitTest/UnitTest.cs | |
parent | 82ed30026efa402952e5977c45398e490e1998f2 (diff) | |
download | sendgrid-csharp-7002bfc825ea9904af7811a84740e001fbb34e0c.zip sendgrid-csharp-7002bfc825ea9904af7811a84740e001fbb34e0c.tar.gz sendgrid-csharp-7002bfc825ea9904af7811a84740e001fbb34e0c.tar.bz2 |
Add POST, DELETE
Diffstat (limited to 'SendGrid/UnitTest/UnitTest.cs')
-rw-r--r-- | SendGrid/UnitTest/UnitTest.cs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs index fa1210e..853d59e 100644 --- a/SendGrid/UnitTest/UnitTest.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -111,9 +111,8 @@ namespace UnitTest TestGet(); TestGetUnique(unsubscribeGroupId); - //TestPost(); - //TestPatch(); - //TestDelete(); + TestPost(); + TestDelete(); } private void TestGet() @@ -134,5 +133,27 @@ namespace UnitTest Assert.IsNotNull(jsonObject); } + private void TestPost() + { + HttpResponseMessage response = client.UnsubscribeGroups.Post("C Sharp Unsubscribes", "Testing the C Sharp Library", false).Result; + Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); + string rawString = response.Content.ReadAsStringAsync().Result; + dynamic jsonObject = JObject.Parse(rawString); + string name = jsonObject.name.ToString(); + string description = jsonObject.description.ToString(); + _unsubscribe_groups_key_id = jsonObject.id.ToString(); + bool is_default = jsonObject.is_default; + Assert.IsNotNull(name); + Assert.IsNotNull(description); + Assert.IsNotNull(_unsubscribe_groups_key_id); + Assert.IsNotNull(is_default); + } + + private void TestDelete() + { + HttpResponseMessage response = client.UnsubscribeGroups.Delete(_unsubscribe_groups_key_id).Result; + Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode); + } + } } |