public void TestAuthorization() { var client = new Client(developerSid, authToken, apiUrl, apiVersion); string authString = Encoding.UTF8.GetString(Convert.FromBase64String(client.authString)); string[] authParts = authString.Split(new char[] { ':' }); Assert.AreEqual(authParts[0], developerSid); Assert.AreEqual(authParts[1], authToken); }
public void TestClientValidation() { Client cr; bool hasException = false; try { cr = new Client(string.Empty, string.Empty); } catch (ArgumentException) { hasException = true; } Assert.IsTrue(hasException); hasException = false; try { cr = new Client(developerSid, string.Empty); } catch (ArgumentException) { hasException = true; } Assert.IsTrue(hasException); hasException = false; try { cr = new Client(string.Empty, authToken); } catch (ArgumentException) { hasException = true; } Assert.IsTrue(hasException); hasException = false; hasException = false; cr = new Client(developerSid, authToken); }
public void test_get() { var client = new Client(developerSid, authToken, apiUrl, apiVersion); var response = client.Get("payments"); }
public void test_different_url_and_version() { apiUrl = "https://www.reddit.com"; apiVersion = "gold"; var client = new Client(developerSid, authToken, apiUrl, apiVersion); Assert.AreEqual(apiUrl + "/" + apiVersion + "/", client.baseUrl); }
public void test_default_url_and_version() { var client = new Client(developerSid, authToken, apiUrl, apiVersion); Assert.AreEqual(client.baseUrl.Replace("-sandbox", string.Empty), "https://api.poundpay.com/silver/"); }
public void test_default_api_url_when_explicity_set_to_None() { apiUrl = null; var client = new Client(developerSid, authToken, apiUrl, apiVersion); Assert.IsFalse(String.IsNullOrEmpty(client.baseUrl)); }
public void TestDeveloperSidValidation() { bool hasException = false; try { var cr = new Client("AB123123123", authToken); } catch (ArgumentException) { hasException = true; } Assert.IsTrue(hasException); }
public void TestDefaultApiVersionWhenExplicitlySetToNone() { apiVersion = null; var client = new Client(developerSid, authToken, apiUrl, apiVersion); Assert.IsTrue(client.baseUrl.EndsWith(Client.API_VERSION + "/"), client.baseUrl + " does not end with " + Client.API_VERSION + "/"); }