summaryrefslogtreecommitdiffstats
path: root/SendGrid/UnitTest/UnitTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SendGrid/UnitTest/UnitTest.cs')
-rw-r--r--SendGrid/UnitTest/UnitTest.cs27
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);
+ }
+
}
}