public void GetEndpointForDefaultModeWithoutEndpoint() { Dictionary<string, string> config = new Dictionary<string, string>(accountConfig); PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret"); platformHandler.GetEndpoint(); }
public void GetEndpointForSandboxMode() { Dictionary<string, string> config = new Dictionary<string, string>(accountConfig); config.Add(BaseConstants.ApplicationModeConfig, BaseConstants.LiveMode); PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret"); Assert.AreEqual(BaseConstants.PlatformLiveEndpoint + "servicename/method", platformHandler.GetEndpoint()); }
public void GetEndpointForDefaultModeWithExplicitEndpoint() { Dictionary<string, string> config = new Dictionary<string, string>(accountConfig); config.Add(BaseConstants.EndpointConfig, Constants.APIEndpointNVP); PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret"); Assert.AreEqual(Constants.APIEndpointNVP + "servicename/method", platformHandler.GetEndpoint()); config.Add("PayPalAPI", Constants.APIEndpointSOAP); platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret"); platformHandler.PortName = "PayPalAPI"; Assert.AreEqual(Constants.APIEndpointSOAP + "/servicename/method", platformHandler.GetEndpoint()); }
public void GetPayloadEndpointWithoutTokenTest() { platformAPIHandler = new PlatformAPICallPreHandler(ConfigManager.Instance.GetProperties(), "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret"); Assert.AreEqual("https://svcs.sandbox.paypal.com/servicename/method", platformAPIHandler.GetEndpoint()); Assert.AreEqual("payload", platformAPIHandler.GetPayload()); SignatureCredential signatureCredential = (SignatureCredential)platformAPIHandler.GetCredential(); TokenAuthorization thirdAuth = (TokenAuthorization)signatureCredential.ThirdPartyAuthorization; Assert.AreEqual("accessToken", thirdAuth.AccessToken); Assert.AreEqual("tokenSecret", thirdAuth.AccessTokenSecret); }