diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-07-08 11:51:33 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-07-08 11:51:33 -0700 |
commit | 222ea4a103b2e7caedc2cd33a472ed182ed3caa5 (patch) | |
tree | fcc751ac138280bfd75eb4e0f80ebb2e6350f886 /SendGrid/UnitTest/UnitTest.cs | |
parent | 017628cea594a2eff151bf17effd6e8fdf486457 (diff) | |
download | sendgrid-csharp-222ea4a103b2e7caedc2cd33a472ed182ed3caa5.zip sendgrid-csharp-222ea4a103b2e7caedc2cd33a472ed182ed3caa5.tar.gz sendgrid-csharp-222ea4a103b2e7caedc2cd33a472ed182ed3caa5.tar.bz2 |
Prism mocked testing working locally
Diffstat (limited to 'SendGrid/UnitTest/UnitTest.cs')
-rw-r--r-- | SendGrid/UnitTest/UnitTest.cs | 2479 |
1 files changed, 352 insertions, 2127 deletions
diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs index 0e4e2b6..4cccd68 100644 --- a/SendGrid/UnitTest/UnitTest.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -4,21 +4,42 @@ using SendGrid.Helpers.Mail; using System.Collections.Generic; using System.Net; using Newtonsoft.Json; +using System.Diagnostics; namespace UnitTest { - // Test the building of the v3/mail/send request body + [TestFixture] - public class Mail + public class UnitTests { static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY"); - public dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); + static string host = "http://localhost:4010"; + public dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + Process process = new Process(); + + [TestFixtureSetUp] + public void Init() + { + if (Environment.GetEnvironmentVariable("TRAVIS") != "true") + { + Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); + Trace.WriteLine("Starting Prism (~20 seconds)"); + + ProcessStartInfo startInfo = new ProcessStartInfo(); + startInfo.WindowStyle = ProcessWindowStyle.Hidden; + startInfo.FileName = "prism.exe"; + startInfo.Arguments = "run -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"; + process.StartInfo = startInfo; + process.Start(); + System.Threading.Thread.Sleep(15000); + } + } // Base case for sending an email [Test] public void TestHelloEmail() { - SendGrid.Helpers.Mail.Mail mail = new SendGrid.Helpers.Mail.Mail(); + Mail mail = new Mail(); Email email = new Email(); email.Address = "test@example.com"; @@ -52,7 +73,7 @@ namespace UnitTest [Test] public void TestKitchenSink() { - SendGrid.Helpers.Mail.Mail mail = new SendGrid.Helpers.Mail.Mail(); + Mail mail = new Mail(); Email email = new Email(); email.Name = "Example User"; @@ -240,23 +261,9 @@ namespace UnitTest new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }); Assert.AreEqual(final, "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"test@example.com\"}}"); } - } - - [TestFixture] - public class v3WebAPI - { - [Test] public void test_access_settings_activity_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'limit': 1 }"; @@ -270,22 +277,14 @@ namespace UnitTest [Test] public void test_access_settings_whitelist_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'ips': [ { 'ip': '192.168.1.1' - }, + }, { 'ip': '192.*.*.*' - }, + }, { 'ip': '192.168.1.3/32' } @@ -301,14 +300,6 @@ namespace UnitTest [Test] public void test_access_settings_whitelist_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -319,18 +310,10 @@ namespace UnitTest [Test] public void test_access_settings_whitelist_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'ids': [ - 1, - 2, + 1, + 2, 3 ] }"; @@ -344,14 +327,6 @@ namespace UnitTest [Test] public void test_access_settings_whitelist__rule_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var rule_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -363,14 +338,6 @@ namespace UnitTest [Test] public void test_access_settings_whitelist__rule_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var rule_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -382,17 +349,9 @@ namespace UnitTest [Test] public void test_alerts_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email_to': 'example@example.com', - 'frequency': 'daily', + 'email_to': 'example@example.com', + 'frequency': 'daily', 'type': 'stats_notification' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -405,14 +364,6 @@ namespace UnitTest [Test] public void test_alerts_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -423,14 +374,6 @@ namespace UnitTest [Test] public void test_alerts__alert_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'email_to': 'example@example.com' }"; @@ -445,14 +388,6 @@ namespace UnitTest [Test] public void test_alerts__alert_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var alert_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -464,14 +399,6 @@ namespace UnitTest [Test] public void test_alerts__alert_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var alert_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -483,20 +410,12 @@ namespace UnitTest [Test] public void test_api_keys_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'name': 'My API Key', - 'sample': 'data', + 'name': 'My API Key', + 'sample': 'data', 'scopes': [ - 'mail.send', - 'alerts.create', + 'mail.send', + 'alerts.create', 'alerts.read' ] }"; @@ -510,14 +429,6 @@ namespace UnitTest [Test] public void test_api_keys_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'limit': 1 }"; @@ -531,18 +442,10 @@ namespace UnitTest [Test] public void test_api_keys__api_key_id__put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'name': 'A New Hope', + 'name': 'A New Hope', 'scopes': [ - 'user.profile.read', + 'user.profile.read', 'user.profile.update' ] }"; @@ -557,14 +460,6 @@ namespace UnitTest [Test] public void test_api_keys__api_key_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'A New Hope' }"; @@ -579,14 +474,6 @@ namespace UnitTest [Test] public void test_api_keys__api_key_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var api_key_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -598,14 +485,6 @@ namespace UnitTest [Test] public void test_api_keys__api_key_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var api_key_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -617,17 +496,9 @@ namespace UnitTest [Test] public void test_asm_groups_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'description': 'Suggestions for products our users might like.', - 'is_default': true, + 'description': 'Suggestions for products our users might like.', + 'is_default': true, 'name': 'Product Suggestions' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -640,14 +511,6 @@ namespace UnitTest [Test] public void test_asm_groups_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'id': 1 }"; @@ -661,17 +524,9 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'description': 'Suggestions for items our users might like.', - 'id': 103, + 'description': 'Suggestions for items our users might like.', + 'id': 103, 'name': 'Item Suggestions' }"; var group_id = "test_url_param"; @@ -685,14 +540,6 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var group_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -704,14 +551,6 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var group_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -723,17 +562,9 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__suppressions_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'recipient_emails': [ - 'test1@example.com', + 'test1@example.com', 'test2@example.com' ] }"; @@ -748,14 +579,6 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__suppressions_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var group_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -767,18 +590,10 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__suppressions_search_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'recipient_emails': [ - 'exists1@example.com', - 'exists2@example.com', + 'exists1@example.com', + 'exists2@example.com', 'doesnotexists@example.com' ] }"; @@ -793,14 +608,6 @@ namespace UnitTest [Test] public void test_asm_groups__group_id__suppressions__email__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var group_id = "test_url_param"; var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -813,14 +620,6 @@ namespace UnitTest [Test] public void test_asm_suppressions_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -831,17 +630,9 @@ namespace UnitTest [Test] public void test_asm_suppressions_global_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'recipient_emails': [ - 'test1@example.com', + 'test1@example.com', 'test2@example.com' ] }"; @@ -855,14 +646,6 @@ namespace UnitTest [Test] public void test_asm_suppressions_global__email__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -874,14 +657,6 @@ namespace UnitTest [Test] public void test_asm_suppressions_global__email__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -893,14 +668,6 @@ namespace UnitTest [Test] public void test_asm_suppressions__email__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -912,20 +679,12 @@ namespace UnitTest [Test] public void test_browsers_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'browsers': 'test_string', - 'end_date': '2016-04-01', - 'limit': 'test_string', - 'offset': 'test_string', + 'aggregated_by': 'day', + 'browsers': 'test_string', + 'end_date': '2016-04-01', + 'limit': 'test_string', + 'offset': 'test_string', 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -938,32 +697,24 @@ namespace UnitTest [Test] public void test_campaigns_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'categories': [ 'spring line' - ], - 'custom_unsubscribe_url': '', - 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>', - 'ip_pool': 'marketing', + ], + 'custom_unsubscribe_url': '', + 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>', + 'ip_pool': 'marketing', 'list_ids': [ - 110, + 110, 124 - ], - 'plain_content': 'Check out our spring line!', + ], + 'plain_content': 'Check out our spring line!', 'segment_ids': [ 110 - ], - 'sender_id': 124451, - 'subject': 'New Products for Spring!', - 'suppression_group_id': 42, + ], + 'sender_id': 124451, + 'subject': 'New Products for Spring!', + 'suppression_group_id': 42, 'title': 'March Newsletter' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -976,16 +727,8 @@ namespace UnitTest [Test] public void test_campaigns_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 1, + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -998,21 +741,13 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'categories': [ 'summer line' - ], - 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>', - 'plain_content': 'Check out our summer line!', - 'subject': 'New Products for Summer!', + ], + 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>', + 'plain_content': 'Check out our summer line!', + 'subject': 'New Products for Summer!', 'title': 'May Newsletter' }"; var campaign_id = "test_url_param"; @@ -1026,14 +761,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var campaign_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1045,14 +772,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var campaign_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1064,14 +783,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__schedules_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'send_at': 1489451436 }"; @@ -1086,14 +797,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__schedules_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'send_at': 1489771528 }"; @@ -1108,14 +811,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__schedules_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var campaign_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1127,14 +822,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__schedules_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var campaign_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1146,14 +833,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__schedules_now_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var campaign_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1165,14 +844,6 @@ namespace UnitTest [Test] public void test_campaigns__campaign_id__schedules_test_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'to': 'your.email@example.com' }"; @@ -1187,17 +858,9 @@ namespace UnitTest [Test] public void test_categories_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'category': 'test_string', - 'limit': 1, + 'category': 'test_string', + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1210,20 +873,12 @@ namespace UnitTest [Test] public void test_categories_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'categories': 'test_string', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, + 'aggregated_by': 'day', + 'categories': 'test_string', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1236,21 +891,13 @@ namespace UnitTest [Test] public void test_categories_stats_sums_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, - 'sort_by_direction': 'asc', - 'sort_by_metric': 'test_string', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, + 'sort_by_direction': 'asc', + 'sort_by_metric': 'test_string', 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1263,17 +910,9 @@ namespace UnitTest [Test] public void test_clients_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1286,17 +925,9 @@ namespace UnitTest [Test] public void test_clients__client_type__stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', 'start_date': '2016-01-01' }"; var client_type = "test_url_param"; @@ -1310,16 +941,8 @@ namespace UnitTest [Test] public void test_contactdb_custom_fields_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'name': 'pet', + 'name': 'pet', 'type': 'text' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1332,14 +955,6 @@ namespace UnitTest [Test] public void test_contactdb_custom_fields_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -1350,14 +965,6 @@ namespace UnitTest [Test] public void test_contactdb_custom_fields__custom_field_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var custom_field_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1369,14 +976,6 @@ namespace UnitTest [Test] public void test_contactdb_custom_fields__custom_field_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var custom_field_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1388,14 +987,6 @@ namespace UnitTest [Test] public void test_contactdb_lists_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'your list name' }"; @@ -1409,14 +1000,6 @@ namespace UnitTest [Test] public void test_contactdb_lists_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -1427,18 +1010,10 @@ namespace UnitTest [Test] public void test_contactdb_lists_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"[ - 1, - 2, - 3, + 1, + 2, + 3, 4 ]"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1451,14 +1026,6 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'newlistname' }"; @@ -1476,14 +1043,6 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'list_id': 1 }"; @@ -1498,14 +1057,6 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'delete_contacts': 'true' }"; @@ -1520,16 +1071,8 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__recipients_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"[ - 'recipient_id1', + 'recipient_id1', 'recipient_id2' ]"; var list_id = "test_url_param"; @@ -1543,17 +1086,9 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__recipients_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'list_id': 1, - 'page': 1, + 'list_id': 1, + 'page': 1, 'page_size': 1 }"; var list_id = "test_url_param"; @@ -1567,14 +1102,6 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__recipients__recipient_id__post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var list_id = "test_url_param"; var recipient_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1587,16 +1114,8 @@ namespace UnitTest [Test] public void test_contactdb_lists__list_id__recipients__recipient_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'list_id': 1, + 'list_id': 1, 'recipient_id': 1 }"; var list_id = "test_url_param"; @@ -1611,18 +1130,10 @@ namespace UnitTest [Test] public void test_contactdb_recipients_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"[ { - 'email': 'jones@example.com', - 'first_name': 'Guy', + 'email': 'jones@example.com', + 'first_name': 'Guy', 'last_name': 'Jones' } ]"; @@ -1636,25 +1147,17 @@ namespace UnitTest [Test] public void test_contactdb_recipients_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"[ { - 'age': 25, - 'email': 'example@example.com', - 'first_name': '', + 'age': 25, + 'email': 'example@example.com', + 'first_name': '', 'last_name': 'User' - }, + }, { - 'age': 25, - 'email': 'example2@example.com', - 'first_name': 'Example', + 'age': 25, + 'email': 'example2@example.com', + 'first_name': 'Example', 'last_name': 'User' } ]"; @@ -1668,16 +1171,8 @@ namespace UnitTest [Test] public void test_contactdb_recipients_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'page': 1, + 'page': 1, 'page_size': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1690,16 +1185,8 @@ namespace UnitTest [Test] public void test_contactdb_recipients_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"[ - 'recipient_id1', + 'recipient_id1', 'recipient_id2' ]"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1712,14 +1199,6 @@ namespace UnitTest [Test] public void test_contactdb_recipients_billable_count_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -1730,14 +1209,6 @@ namespace UnitTest [Test] public void test_contactdb_recipients_count_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -1748,16 +1219,8 @@ namespace UnitTest [Test] public void test_contactdb_recipients_search_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - '%7Bfield_name%7D': 'test_string', + '%7Bfield_name%7D': 'test_string', '{field_name}': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1770,14 +1233,6 @@ namespace UnitTest [Test] public void test_contactdb_recipients__recipient_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var recipient_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1789,14 +1244,6 @@ namespace UnitTest [Test] public void test_contactdb_recipients__recipient_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var recipient_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1808,14 +1255,6 @@ namespace UnitTest [Test] public void test_contactdb_recipients__recipient_id__lists_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var recipient_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1827,14 +1266,6 @@ namespace UnitTest [Test] public void test_contactdb_reserved_fields_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -1845,36 +1276,28 @@ namespace UnitTest [Test] public void test_contactdb_segments_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'conditions': [ { - 'and_or': '', - 'field': 'last_name', - 'operator': 'eq', + 'and_or': '', + 'field': 'last_name', + 'operator': 'eq', 'value': 'Miller' - }, + }, { - 'and_or': 'and', - 'field': 'last_clicked', - 'operator': 'gt', + 'and_or': 'and', + 'field': 'last_clicked', + 'operator': 'gt', 'value': '01/02/2015' - }, + }, { - 'and_or': 'or', - 'field': 'clicks.campaign_identifier', - 'operator': 'eq', + 'and_or': 'or', + 'field': 'clicks.campaign_identifier', + 'operator': 'eq', 'value': '513' } - ], - 'list_id': 4, + ], + 'list_id': 4, 'name': 'Last Name Miller' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1887,14 +1310,6 @@ namespace UnitTest [Test] public void test_contactdb_segments_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -1905,24 +1320,16 @@ namespace UnitTest [Test] public void test_contactdb_segments__segment_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'conditions': [ { - 'and_or': '', - 'field': 'last_name', - 'operator': 'eq', + 'and_or': '', + 'field': 'last_name', + 'operator': 'eq', 'value': 'Miller' } - ], - 'list_id': 5, + ], + 'list_id': 5, 'name': 'The Millers' }"; string queryParams = @"{ @@ -1939,14 +1346,6 @@ namespace UnitTest [Test] public void test_contactdb_segments__segment_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'segment_id': 1 }"; @@ -1961,14 +1360,6 @@ namespace UnitTest [Test] public void test_contactdb_segments__segment_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'delete_contacts': 'true' }"; @@ -1983,16 +1374,8 @@ namespace UnitTest [Test] public void test_contactdb_segments__segment_id__recipients_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'page': 1, + 'page': 1, 'page_size': 1 }"; var segment_id = "test_url_param"; @@ -2006,19 +1389,11 @@ namespace UnitTest [Test] public void test_devices_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2031,20 +1406,12 @@ namespace UnitTest [Test] public void test_geo_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'country': 'US', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, + 'aggregated_by': 'day', + 'country': 'US', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2057,19 +1424,11 @@ namespace UnitTest [Test] public void test_ips_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'exclude_whitelabels': 'true', - 'ip': 'test_string', - 'limit': 1, - 'offset': 1, + 'exclude_whitelabels': 'true', + 'ip': 'test_string', + 'limit': 1, + 'offset': 1, 'subuser': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2082,14 +1441,6 @@ namespace UnitTest [Test] public void test_ips_assigned_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2100,14 +1451,6 @@ namespace UnitTest [Test] public void test_ips_pools_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'marketing' }"; @@ -2121,14 +1464,6 @@ namespace UnitTest [Test] public void test_ips_pools_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2139,14 +1474,6 @@ namespace UnitTest [Test] public void test_ips_pools__pool_name__put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'new_pool_name' }"; @@ -2161,14 +1488,6 @@ namespace UnitTest [Test] public void test_ips_pools__pool_name__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var pool_name = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -2180,14 +1499,6 @@ namespace UnitTest [Test] public void test_ips_pools__pool_name__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var pool_name = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -2199,14 +1510,6 @@ namespace UnitTest [Test] public void test_ips_pools__pool_name__ips_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'ip': '0.0.0.0' }"; @@ -2221,14 +1524,6 @@ namespace UnitTest [Test] public void test_ips_pools__pool_name__ips__ip__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var pool_name = "test_url_param"; var ip = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2241,14 +1536,6 @@ namespace UnitTest [Test] public void test_ips_warmup_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'ip': '0.0.0.0' }"; @@ -2262,14 +1549,6 @@ namespace UnitTest [Test] public void test_ips_warmup_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2280,14 +1559,6 @@ namespace UnitTest [Test] public void test_ips_warmup__ip_address__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var ip_address = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -2299,14 +1570,6 @@ namespace UnitTest [Test] public void test_ips_warmup__ip_address__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var ip_address = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -2318,14 +1581,6 @@ namespace UnitTest [Test] public void test_ips__ip_address__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var ip_address = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -2337,14 +1592,6 @@ namespace UnitTest [Test] public void test_mail_batch_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "201"); @@ -2355,14 +1602,6 @@ namespace UnitTest [Test] public void test_mail_batch__batch_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var batch_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -2374,148 +1613,140 @@ namespace UnitTest [Test] public void test_mail_send_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'asm': { - 'group_id': 1, + 'group_id': 1, 'groups_to_display': [ - 1, - 2, + 1, + 2, 3 ] - }, + }, 'attachments': [ { - 'content': '[BASE64 encoded content block here]', - 'content_id': 'ii_139db99fdb5c3704', - 'disposition': 'inline', - 'filename': 'file1.jpg', - 'name': 'file1', + 'content': '[BASE64 encoded content block here]', + 'content_id': 'ii_139db99fdb5c3704', + 'disposition': 'inline', + 'filename': 'file1.jpg', + 'name': 'file1', 'type': 'jpg' } - ], - 'batch_id': '[YOUR BATCH ID GOES HERE]', + ], + 'batch_id': '[YOUR BATCH ID GOES HERE]', 'categories': [ - 'category1', + 'category1', 'category2' - ], + ], 'content': [ { - 'type': 'text/html', + 'type': 'text/html', 'value': '<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>' } - ], + ], 'custom_args': { - 'New Argument 1': 'New Value 1', - 'activationAttempt': '1', + 'New Argument 1': 'New Value 1', + 'activationAttempt': '1', 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]' - }, + }, 'from': { - 'email': 'sam.smith@example.com', + 'email': 'sam.smith@example.com', 'name': 'Sam Smith' - }, - 'headers': {}, - 'ip_pool_name': '[YOUR POOL NAME GOES HERE]', + }, + 'headers': {}, + 'ip_pool_name': '[YOUR POOL NAME GOES HERE]', 'mail_settings': { 'bcc': { - 'email': 'ben.doe@example.com', + 'email': 'ben.doe@example.com', 'enable': true - }, + }, 'bypass_list_management': { 'enable': true - }, + }, 'footer': { - 'enable': true, - 'html': '<p>Thanks</br>The SendGrid Team</p>', + 'enable': true, + 'html': '<p>Thanks</br>The SendGrid Team</p>', 'text': 'Thanks,/n The SendGrid Team' - }, + }, 'sandbox_mode': { 'enable': false - }, + }, 'spam_check': { - 'enable': true, - 'post_to_url': 'http://example.com/compliance', + 'enable': true, + 'post_to_url': 'http://example.com/compliance', 'threshold': 3 } - }, + }, 'personalizations': [ { 'bcc': [ { - 'email': 'sam.doe@example.com', + 'email': 'sam.doe@example.com', 'name': 'Sam Doe' } - ], + ], 'cc': [ { - 'email': 'jane.doe@example.com', + 'email': 'jane.doe@example.com', 'name': 'Jane Doe' } - ], + ], 'custom_args': { - 'New Argument 1': 'New Value 1', - 'activationAttempt': '1', + 'New Argument 1': 'New Value 1', + 'activationAttempt': '1', 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]' - }, + }, 'headers': { - 'X-Accept-Language': 'en', + 'X-Accept-Language': 'en', 'X-Mailer': 'MyApp' - }, - 'send_at': 1409348513, - 'subject': 'Hello, World!', + }, + 'send_at': 1409348513, + 'subject': 'Hello, World!', 'substitutions': { - 'id': 'substitutions', + 'id': 'substitutions', 'type': 'object' - }, + }, 'to': [ { - 'email': 'john.doe@example.com', + 'email': 'john.doe@example.com', 'name': 'John Doe' } ] } - ], + ], 'reply_to': { - 'email': 'sam.smith@example.com', + 'email': 'sam.smith@example.com', 'name': 'Sam Smith' - }, + }, 'sections': { 'section': { - ':sectionName1': 'section 1 text', + ':sectionName1': 'section 1 text', ':sectionName2': 'section 2 text' } - }, - 'send_at': 1409348513, - 'subject': 'Hello, World!', - 'template_id': '[YOUR TEMPLATE ID GOES HERE]', + }, + 'send_at': 1409348513, + 'subject': 'Hello, World!', + 'template_id': '[YOUR TEMPLATE ID GOES HERE]', 'tracking_settings': { 'click_tracking': { - 'enable': true, + 'enable': true, 'enable_text': true - }, + }, 'ganalytics': { - 'enable': true, - 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]', - 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]', - 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]', - 'utm_name': '[NAME OF YOUR CAMPAIGN]', + 'enable': true, + 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]', + 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]', + 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]', + 'utm_name': '[NAME OF YOUR CAMPAIGN]', 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]' - }, + }, 'open_tracking': { - 'enable': true, + 'enable': true, 'substitution_tag': '%opentrack' - }, + }, 'subscription_tracking': { - 'enable': true, - 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.', - 'substitution_tag': '<%click here%>', + 'enable': true, + 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.', + 'substitution_tag': '<%click here%>', 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.' } } @@ -2530,16 +1761,8 @@ namespace UnitTest [Test] public void test_mail_settings_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 1, + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2552,18 +1775,10 @@ namespace UnitTest [Test] public void test_mail_settings_address_whitelist_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, + 'enabled': true, 'list': [ - 'email1@example.com', + 'email1@example.com', 'example.com' ] }"; @@ -2577,14 +1792,6 @@ namespace UnitTest [Test] public void test_mail_settings_address_whitelist_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2595,16 +1802,8 @@ namespace UnitTest [Test] public void test_mail_settings_bcc_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email': 'email@example.com', + 'email': 'email@example.com', 'enabled': false }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2617,14 +1816,6 @@ namespace UnitTest [Test] public void test_mail_settings_bcc_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2635,17 +1826,9 @@ namespace UnitTest [Test] public void test_mail_settings_bounce_purge_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, - 'hard_bounces': 5, + 'enabled': true, + 'hard_bounces': 5, 'soft_bounces': 5 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2658,14 +1841,6 @@ namespace UnitTest [Test] public void test_mail_settings_bounce_purge_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2676,17 +1851,9 @@ namespace UnitTest [Test] public void test_mail_settings_footer_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, - 'html_content': '...', + 'enabled': true, + 'html_content': '...', 'plain_content': '...' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2699,14 +1866,6 @@ namespace UnitTest [Test] public void test_mail_settings_footer_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2717,16 +1876,8 @@ namespace UnitTest [Test] public void test_mail_settings_forward_bounce_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email': 'example@example.com', + 'email': 'example@example.com', 'enabled': true }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2739,14 +1890,6 @@ namespace UnitTest [Test] public void test_mail_settings_forward_bounce_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2757,16 +1900,8 @@ namespace UnitTest [Test] public void test_mail_settings_forward_spam_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email': '', + 'email': '', 'enabled': false }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2779,14 +1914,6 @@ namespace UnitTest [Test] public void test_mail_settings_forward_spam_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2797,14 +1924,6 @@ namespace UnitTest [Test] public void test_mail_settings_plain_content_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'enabled': false }"; @@ -2818,14 +1937,6 @@ namespace UnitTest [Test] public void test_mail_settings_plain_content_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2836,17 +1947,9 @@ namespace UnitTest [Test] public void test_mail_settings_spam_check_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, - 'max_score': 5, + 'enabled': true, + 'max_score': 5, 'url': 'url' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2859,14 +1962,6 @@ namespace UnitTest [Test] public void test_mail_settings_spam_check_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2877,16 +1972,8 @@ namespace UnitTest [Test] public void test_mail_settings_template_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, + 'enabled': true, 'html_content': '<% body %>' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2899,14 +1986,6 @@ namespace UnitTest [Test] public void test_mail_settings_template_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -2917,20 +1996,12 @@ namespace UnitTest [Test] public void test_mailbox_providers_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 1, - 'mailbox_providers': 'test_string', - 'offset': 1, + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'mailbox_providers': 'test_string', + 'offset': 1, 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2943,16 +2014,8 @@ namespace UnitTest [Test] public void test_partner_settings_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 1, + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2965,17 +2028,9 @@ namespace UnitTest [Test] public void test_partner_settings_new_relic_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enable_subuser_statistics': true, - 'enabled': true, + 'enable_subuser_statistics': true, + 'enabled': true, 'license_key': '' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2988,14 +2043,6 @@ namespace UnitTest [Test] public void test_partner_settings_new_relic_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -3006,14 +2053,6 @@ namespace UnitTest [Test] public void test_scopes_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -3024,19 +2063,11 @@ namespace UnitTest [Test] public void test_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3049,21 +2080,13 @@ namespace UnitTest [Test] public void test_subusers_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email': 'John@example.com', + 'email': 'John@example.com', 'ips': [ - '1.1.1.1', + '1.1.1.1', '2.2.2.2' - ], - 'password': 'johns_password', + ], + 'password': 'johns_password', 'username': 'John@example.com' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3076,17 +2099,9 @@ namespace UnitTest [Test] public void test_subusers_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 1, - 'offset': 1, + 'limit': 1, + 'offset': 1, 'username': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3099,14 +2114,6 @@ namespace UnitTest [Test] public void test_subusers_reputations_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'usernames': 'test_string' }"; @@ -3120,20 +2127,12 @@ namespace UnitTest [Test] public void test_subusers_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, - 'start_date': '2016-01-01', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, + 'start_date': '2016-01-01', 'subusers': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3146,20 +2145,12 @@ namespace UnitTest [Test] public void test_subusers_stats_monthly_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'date': 'test_string', - 'limit': 1, - 'offset': 1, - 'sort_by_direction': 'asc', - 'sort_by_metric': 'test_string', + 'date': 'test_string', + 'limit': 1, + 'offset': 1, + 'sort_by_direction': 'asc', + 'sort_by_metric': 'test_string', 'subuser': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3172,21 +2163,13 @@ namespace UnitTest [Test] public void test_subusers_stats_sums_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 1, - 'offset': 1, - 'sort_by_direction': 'asc', - 'sort_by_metric': 'test_string', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, + 'sort_by_direction': 'asc', + 'sort_by_metric': 'test_string', 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3199,14 +2182,6 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'disabled': false }"; @@ -3221,14 +2196,6 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var subuser_name = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3240,14 +2207,6 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__ips_put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"[ '127.0.0.1' ]"; @@ -3262,16 +2221,8 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__monitor_put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email': 'example@example.com', + 'email': 'example@example.com', 'frequency': 500 }"; var subuser_name = "test_url_param"; @@ -3285,16 +2236,8 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__monitor_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'email': 'example@example.com', + 'email': 'example@example.com', 'frequency': 50000 }"; var subuser_name = "test_url_param"; @@ -3308,14 +2251,6 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__monitor_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var subuser_name = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3327,14 +2262,6 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__monitor_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var subuser_name = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3346,19 +2273,11 @@ namespace UnitTest [Test] public void test_subusers__subuser_name__stats_monthly_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'date': 'test_string', - 'limit': 1, - 'offset': 1, - 'sort_by_direction': 'asc', + 'date': 'test_string', + 'limit': 1, + 'offset': 1, + 'sort_by_direction': 'asc', 'sort_by_metric': 'test_string' }"; var subuser_name = "test_url_param"; @@ -3372,18 +2291,10 @@ namespace UnitTest [Test] public void test_suppression_blocks_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'end_time': 1, - 'limit': 1, - 'offset': 1, + 'end_time': 1, + 'limit': 1, + 'offset': 1, 'start_time': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3396,18 +2307,10 @@ namespace UnitTest [Test] public void test_suppression_blocks_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'delete_all': false, + 'delete_all': false, 'emails': [ - 'example1@example.com', + 'example1@example.com', 'example2@example.com' ] }"; @@ -3421,14 +2324,6 @@ namespace UnitTest [Test] public void test_suppression_blocks__email__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3440,14 +2335,6 @@ namespace UnitTest [Test] public void test_suppression_blocks__email__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3459,16 +2346,8 @@ namespace UnitTest [Test] public void test_suppression_bounces_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'end_time': 1, + 'end_time': 1, 'start_time': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3481,18 +2360,10 @@ namespace UnitTest [Test] public void test_suppression_bounces_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'delete_all': true, + 'delete_all': true, 'emails': [ - 'example@example.com', + 'example@example.com', 'example2@example.com' ] }"; @@ -3506,14 +2377,6 @@ namespace UnitTest [Test] public void test_suppression_bounces__email__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3525,14 +2388,6 @@ namespace UnitTest [Test] public void test_suppression_bounces__email__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'email_address': 'example@example.com' }"; @@ -3547,18 +2402,10 @@ namespace UnitTest [Test] public void test_suppression_invalid_emails_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'end_time': 1, - 'limit': 1, - 'offset': 1, + 'end_time': 1, + 'limit': 1, + 'offset': 1, 'start_time': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3571,18 +2418,10 @@ namespace UnitTest [Test] public void test_suppression_invalid_emails_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'delete_all': false, + 'delete_all': false, 'emails': [ - 'example1@example.com', + 'example1@example.com', 'example2@example.com' ] }"; @@ -3596,14 +2435,6 @@ namespace UnitTest [Test] public void test_suppression_invalid_emails__email__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3615,14 +2446,6 @@ namespace UnitTest [Test] public void test_suppression_invalid_emails__email__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3634,14 +2457,6 @@ namespace UnitTest [Test] public void test_suppression_spam_report__email__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3653,14 +2468,6 @@ namespace UnitTest [Test] public void test_suppression_spam_report__email__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var email = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3672,18 +2479,10 @@ namespace UnitTest [Test] public void test_suppression_spam_reports_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'end_time': 1, - 'limit': 1, - 'offset': 1, + 'end_time': 1, + 'limit': 1, + 'offset': 1, 'start_time': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3696,18 +2495,10 @@ namespace UnitTest [Test] public void test_suppression_spam_reports_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'delete_all': false, + 'delete_all': false, 'emails': [ - 'example1@example.com', + 'example1@example.com', 'example2@example.com' ] }"; @@ -3721,18 +2512,10 @@ namespace UnitTest [Test] public void test_suppression_unsubscribes_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'end_time': 1, - 'limit': 1, - 'offset': 1, + 'end_time': 1, + 'limit': 1, + 'offset': 1, 'start_time': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3745,14 +2528,6 @@ namespace UnitTest [Test] public void test_templates_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'example_name' }"; @@ -3766,14 +2541,6 @@ namespace UnitTest [Test] public void test_templates_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -3784,14 +2551,6 @@ namespace UnitTest [Test] public void test_templates__template_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'new_example_name' }"; @@ -3806,14 +2565,6 @@ namespace UnitTest [Test] public void test_templates__template_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var template_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3825,14 +2576,6 @@ namespace UnitTest [Test] public void test_templates__template_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var template_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -3844,20 +2587,12 @@ namespace UnitTest [Test] public void test_templates__template_id__versions_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'active': 1, - 'html_content': '<%body%>', - 'name': 'example_version_name', - 'plain_content': '<%body%>', - 'subject': '<%subject%>', + 'active': 1, + 'html_content': '<%body%>', + 'name': 'example_version_name', + 'plain_content': '<%body%>', + 'subject': '<%subject%>', 'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543' }"; var template_id = "test_url_param"; @@ -3871,19 +2606,11 @@ namespace UnitTest [Test] public void test_templates__template_id__versions__version_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'active': 1, - 'html_content': '<%body%>', - 'name': 'updated_example_name', - 'plain_content': '<%body%>', + 'active': 1, + 'html_content': '<%body%>', + 'name': 'updated_example_name', + 'plain_content': '<%body%>', 'subject': '<%subject%>' }"; var template_id = "test_url_param"; @@ -3898,14 +2625,6 @@ namespace UnitTest [Test] public void test_templates__template_id__versions__version_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var template_id = "test_url_param"; var version_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3918,14 +2637,6 @@ namespace UnitTest [Test] public void test_templates__template_id__versions__version_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var template_id = "test_url_param"; var version_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3938,14 +2649,6 @@ namespace UnitTest [Test] public void test_templates__template_id__versions__version_id__activate_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var template_id = "test_url_param"; var version_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3958,16 +2661,8 @@ namespace UnitTest [Test] public void test_tracking_settings_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 1, + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3980,14 +2675,6 @@ namespace UnitTest [Test] public void test_tracking_settings_click_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'enabled': true }"; @@ -4001,14 +2688,6 @@ namespace UnitTest [Test] public void test_tracking_settings_click_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4019,20 +2698,12 @@ namespace UnitTest [Test] public void test_tracking_settings_google_analytics_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, - 'utm_campaign': 'website', - 'utm_content': '', - 'utm_medium': 'email', - 'utm_source': 'sendgrid.com', + 'enabled': true, + 'utm_campaign': 'website', + 'utm_content': '', + 'utm_medium': 'email', + 'utm_source': 'sendgrid.com', 'utm_term': '' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4045,14 +2716,6 @@ namespace UnitTest [Test] public void test_tracking_settings_google_analytics_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4063,14 +2726,6 @@ namespace UnitTest [Test] public void test_tracking_settings_open_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'enabled': true }"; @@ -4084,14 +2739,6 @@ namespace UnitTest [Test] public void test_tracking_settings_open_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4102,20 +2749,12 @@ namespace UnitTest [Test] public void test_tracking_settings_subscription_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'enabled': true, - 'html_content': 'html content', - 'landing': 'landing page html', - 'plain_content': 'text content', - 'replace': 'replacement tag', + 'enabled': true, + 'html_content': 'html content', + 'landing': 'landing page html', + 'plain_content': 'text content', + 'replace': 'replacement tag', 'url': 'url' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4128,14 +2767,6 @@ namespace UnitTest [Test] public void test_tracking_settings_subscription_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4146,14 +2777,6 @@ namespace UnitTest [Test] public void test_user_account_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4164,14 +2787,6 @@ namespace UnitTest [Test] public void test_user_credits_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4182,14 +2797,6 @@ namespace UnitTest [Test] public void test_user_email_put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'email': 'example@example.com' }"; @@ -4203,14 +2810,6 @@ namespace UnitTest [Test] public void test_user_email_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4221,16 +2820,8 @@ namespace UnitTest [Test] public void test_user_password_put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'new_password': 'new_password', + 'new_password': 'new_password', 'old_password': 'old_password' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4243,17 +2834,9 @@ namespace UnitTest [Test] public void test_user_profile_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'city': 'Orange', - 'first_name': 'Example', + 'city': 'Orange', + 'first_name': 'Example', 'last_name': 'User' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4266,14 +2849,6 @@ namespace UnitTest [Test] public void test_user_profile_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4284,16 +2859,8 @@ namespace UnitTest [Test] public void test_user_scheduled_sends_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'batch_id': 'YOUR_BATCH_ID', + 'batch_id': 'YOUR_BATCH_ID', 'status': 'pause' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4306,14 +2873,6 @@ namespace UnitTest [Test] public void test_user_scheduled_sends_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4324,14 +2883,6 @@ namespace UnitTest [Test] public void test_user_scheduled_sends__batch_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'status': 'pause' }"; @@ -4346,14 +2897,6 @@ namespace UnitTest [Test] public void test_user_scheduled_sends__batch_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var batch_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4365,14 +2908,6 @@ namespace UnitTest [Test] public void test_user_scheduled_sends__batch_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var batch_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4384,16 +2919,8 @@ namespace UnitTest [Test] public void test_user_settings_enforced_tls_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'require_tls': true, + 'require_tls': true, 'require_valid_cert': false }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4406,14 +2933,6 @@ namespace UnitTest [Test] public void test_user_settings_enforced_tls_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4424,14 +2943,6 @@ namespace UnitTest [Test] public void test_user_username_put() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'username': 'test_username' }"; @@ -4445,14 +2956,6 @@ namespace UnitTest [Test] public void test_user_username_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4463,27 +2966,19 @@ namespace UnitTest [Test] public void test_user_webhooks_event_settings_patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'bounce': true, - 'click': true, - 'deferred': true, - 'delivered': true, - 'dropped': true, - 'enabled': true, - 'group_resubscribe': true, - 'group_unsubscribe': true, - 'open': true, - 'processed': true, - 'spam_report': true, - 'unsubscribe': true, + 'bounce': true, + 'click': true, + 'deferred': true, + 'delivered': true, + 'dropped': true, + 'enabled': true, + 'group_resubscribe': true, + 'group_unsubscribe': true, + 'open': true, + 'processed': true, + 'spam_report': true, + 'unsubscribe': true, 'url': 'url' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4496,14 +2991,6 @@ namespace UnitTest [Test] public void test_user_webhooks_event_settings_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4514,14 +3001,6 @@ namespace UnitTest [Test] public void test_user_webhooks_event_test_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'url': 'url' }"; @@ -4535,18 +3014,10 @@ namespace UnitTest [Test] public void test_user_webhooks_parse_settings_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'hostname': 'myhostname.com', - 'send_raw': false, - 'spam_check': true, + 'hostname': 'myhostname.com', + 'send_raw': false, + 'spam_check': true, 'url': 'http://email.myhosthame.com' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4559,14 +3030,6 @@ namespace UnitTest [Test] public void test_user_webhooks_parse_settings_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4577,17 +3040,9 @@ namespace UnitTest [Test] public void test_user_webhooks_parse_settings__hostname__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'send_raw': true, - 'spam_check': false, + 'send_raw': true, + 'spam_check': false, 'url': 'http://newdomain.com/parse' }"; var hostname = "test_url_param"; @@ -4601,14 +3056,6 @@ namespace UnitTest [Test] public void test_user_webhooks_parse_settings__hostname__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var hostname = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4620,14 +3067,6 @@ namespace UnitTest [Test] public void test_user_webhooks_parse_settings__hostname__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var hostname = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4639,19 +3078,11 @@ namespace UnitTest [Test] public void test_user_webhooks_parse_stats_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 'test_string', - 'offset': 'test_string', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 'test_string', + 'offset': 'test_string', 'start_date': '2016-01-01' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4664,24 +3095,16 @@ namespace UnitTest [Test] public void test_whitelabel_domains_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'automatic_security': false, - 'custom_spf': true, - 'default': true, - 'domain': 'example.com', + 'automatic_security': false, + 'custom_spf': true, + 'default': true, + 'domain': 'example.com', 'ips': [ - '192.168.1.1', + '192.168.1.1', '192.168.1.2' - ], - 'subdomain': 'news', + ], + 'subdomain': 'news', 'username': 'john@example.com' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4694,19 +3117,11 @@ namespace UnitTest [Test] public void test_whitelabel_domains_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'domain': 'test_string', - 'exclude_subusers': 'true', - 'limit': 1, - 'offset': 1, + 'domain': 'test_string', + 'exclude_subusers': 'true', + 'limit': 1, + 'offset': 1, 'username': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4719,14 +3134,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains_default_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4737,14 +3144,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains_subuser_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); @@ -4755,14 +3154,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains_subuser_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "204"); @@ -4773,16 +3164,8 @@ namespace UnitTest [Test] public void test_whitelabel_domains__domain_id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'custom_spf': true, + 'custom_spf': true, 'default': false }"; var domain_id = "test_url_param"; @@ -4796,14 +3179,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains__domain_id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var domain_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4815,14 +3190,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains__domain_id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var domain_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4834,14 +3201,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains__domain_id__subuser_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'username': 'jane@example.com' }"; @@ -4856,14 +3215,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains__id__ips_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'ip': '192.168.0.1' }"; @@ -4878,14 +3229,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains__id__ips__ip__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; var ip = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4898,14 +3241,6 @@ namespace UnitTest [Test] public void test_whitelabel_domains__id__validate_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4917,17 +3252,9 @@ namespace UnitTest [Test] public void test_whitelabel_ips_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'domain': 'example.com', - 'ip': '192.168.1.1', + 'domain': 'example.com', + 'ip': '192.168.1.1', 'subdomain': 'email' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4940,17 +3267,9 @@ namespace UnitTest [Test] public void test_whitelabel_ips_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'ip': 'test_string', - 'limit': 1, + 'ip': 'test_string', + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -4963,14 +3282,6 @@ namespace UnitTest [Test] public void test_whitelabel_ips__id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4982,14 +3293,6 @@ namespace UnitTest [Test] public void test_whitelabel_ips__id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -5001,14 +3304,6 @@ namespace UnitTest [Test] public void test_whitelabel_ips__id__validate_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -5020,21 +3315,13 @@ namespace UnitTest [Test] public void test_whitelabel_links_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ - 'default': true, - 'domain': 'example.com', + 'default': true, + 'domain': 'example.com', 'subdomain': 'mail' }"; string queryParams = @"{ - 'limit': 1, + 'limit': 1, 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -5047,14 +3334,6 @@ namespace UnitTest [Test] public void test_whitelabel_links_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'limit': 1 }"; @@ -5068,14 +3347,6 @@ namespace UnitTest [Test] public void test_whitelabel_links_default_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'domain': 'test_string' }"; @@ -5089,14 +3360,6 @@ namespace UnitTest [Test] public void test_whitelabel_links_subuser_get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'username': 'test_string' }"; @@ -5110,14 +3373,6 @@ namespace UnitTest [Test] public void test_whitelabel_links_subuser_delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'username': 'test_string' }"; @@ -5131,14 +3386,6 @@ namespace UnitTest [Test] public void test_whitelabel_links__id__patch() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'default': true }"; @@ -5153,14 +3400,6 @@ namespace UnitTest [Test] public void test_whitelabel_links__id__get() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -5172,14 +3411,6 @@ namespace UnitTest [Test] public void test_whitelabel_links__id__delete() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -5191,14 +3422,6 @@ namespace UnitTest [Test] public void test_whitelabel_links__id__validate_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); var id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -5210,14 +3433,6 @@ namespace UnitTest [Test] public void test_whitelabel_links__link_id__subuser_post() { - string _apiKey = "SendGrid API Key"; - string host = ""; - if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { - host = Environment.GetEnvironmentVariable("MOCK_HOST"); - } else { - host = "http://localhost:4010"; - } - dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'username': 'jane@example.com' }"; @@ -5229,5 +3444,15 @@ namespace UnitTest Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); } + [TestFixtureTearDown] + public void Dispose() + { + if (Environment.GetEnvironmentVariable("TRAVIS") != "true") + { + process.Kill(); + Trace.WriteLine("Sutting Down Prism"); + } + } + } } |