public void GenerateHeaderStrategyWithoutToken()
 {
     certHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(Constants.APIEndpointNVP);
     certCredential = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
     Dictionary<string, string> header = certHttpHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
     string username = header[BaseConstants.PayPalSecurityUserIdHeader];
     string password = header[BaseConstants.PayPalSecurityPasswordHeader];
     Assert.AreEqual("testusername", username);
     Assert.AreEqual("testpassword", password);
 }
        public void GenerateHeaderStrategyWithoutToken()
        {
            certHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(UnitTestConstants.APIEndpointNVP);
            certCredential             = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
            Dictionary <string, string> header = certHttpHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
            string username = header[BaseConstants.PAYPAL_SECURITY_USERID_HEADER];
            string password = header[BaseConstants.PAYPAL_SECURITY_PASSWORD_HEADER];

            Assert.AreEqual("testusername", username);
            Assert.AreEqual("testpassword", password);
        }
        public void GenerateHeaderStrategyWithToken()
        {
            certHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(UnitTestConstants.APIEndpointSOAP);
            TokenAuthorization          toknAuthorization = new TokenAuthorization(UnitTestConstants.AccessToken, UnitTestConstants.TokenSecret);
            CertificateCredential       certCredential    = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y", toknAuthorization);
            Dictionary <string, string> header            = certHttpHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
            string authHeader = header[BaseConstants.PAYPAL_AUTHORIZATION_MERCHANT_HEADER];

            string[] headers = authHeader.Split(',');
            Assert.AreEqual("token=" + UnitTestConstants.AccessToken, headers[0]);
        }
        public void GenerateHeaderStrategyWithoutTokenTest()
        {
            certHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(Constants.APIEndpointNVP);
            certCredential             = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
            Dictionary <string, string> header = certHttpHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
            string username = header[BaseConstants.PayPalSecurityUserIdHeader];
            string password = header[BaseConstants.PayPalSecurityPasswordHeader];

            Assert.AreEqual("testusername", username);
            Assert.AreEqual("testpassword", password);
        }
        public void GenerateHeaderStrategyWithTokenTest()
        {
            certHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(Constants.APIEndpointSOAP);
            TokenAuthorization toknAuthorization = new TokenAuthorization(Constants.AccessToken, Constants.TokenSecret);

            certCredential = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y", toknAuthorization);
            Dictionary <string, string> header = certHttpHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
            string authHeader = header[BaseConstants.PayPalAuthorizationPlatformHeader];

            string[] headers = authHeader.Split(',');
            Assert.AreEqual("token=" + Constants.AccessToken, headers[0]);
        }
 public void GenerateHeaderStrategyWithToken()
 {
     certHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(Constants.APIEndpointSOAP);
     TokenAuthorization toknAuthorization = new TokenAuthorization(Constants.AccessToken, Constants.TokenSecret);
     CertificateCredential certCredential = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y", toknAuthorization);
     Dictionary<string, string> header = certHttpHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
     string authHeader = header[BaseConstants.PayPalAuthorizationMerchantHeader];
     string[] headers = authHeader.Split(',');
     Assert.AreEqual("token=" + Constants.AccessToken, headers[0]);
 }