diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-10 14:36:11 -0800 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-10 14:36:11 -0800 |
commit | 82ed30026efa402952e5977c45398e490e1998f2 (patch) | |
tree | 9382f4d190fe318ee5fdebb74b91f6ceed4963f1 /SendGrid/UnitTest/UnitTest.cs | |
parent | d685ac8edd21a6063d9f1f7236e4e1e3f2d7ab94 (diff) | |
download | sendgrid-csharp-82ed30026efa402952e5977c45398e490e1998f2.zip sendgrid-csharp-82ed30026efa402952e5977c45398e490e1998f2.tar.gz sendgrid-csharp-82ed30026efa402952e5977c45398e490e1998f2.tar.bz2 |
GET implemented
Diffstat (limited to 'SendGrid/UnitTest/UnitTest.cs')
-rw-r--r-- | SendGrid/UnitTest/UnitTest.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs index 5d1b696..fa1210e 100644 --- a/SendGrid/UnitTest/UnitTest.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using NUnit.Framework; using Newtonsoft.Json.Linq; using SendGrid; +using Newtonsoft.Json; namespace UnitTest { @@ -94,4 +95,44 @@ namespace UnitTest Task.WaitAll(tasks); } } + + [TestFixture] + public class UnsubscribeGroups + { + static string _baseUri = "https://api.sendgrid.com/"; + static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY"); + public Client client = new Client(_apiKey, _baseUri); + private static string _unsubscribe_groups_key_id = ""; + + [Test] + public void UnsubscribeGroupsIntegrationTest() + { + int unsubscribeGroupId = 69; + + TestGet(); + TestGetUnique(unsubscribeGroupId); + //TestPost(); + //TestPatch(); + //TestDelete(); + } + + private void TestGet() + { + HttpResponseMessage response = client.UnsubscribeGroups.Get().Result; + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + string rawString = response.Content.ReadAsStringAsync().Result; + dynamic jsonObject = JsonConvert.DeserializeObject(rawString); + Assert.IsNotNull(jsonObject); + } + + private void TestGetUnique(int unsubscribeGroupId) + { + HttpResponseMessage response = client.UnsubscribeGroups.Get(unsubscribeGroupId).Result; + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + string rawString = response.Content.ReadAsStringAsync().Result; + dynamic jsonObject = JsonConvert.DeserializeObject(rawString); + Assert.IsNotNull(jsonObject); + } + + } } |