Esempio n. 1
0
        public void SetupState()
        {
            var configuration = ConfigurationHelper.GetConfiguration();
            var context       = new ApiContext(Environments.QA, configuration["Pricing:Username"], configuration["Pricing:Password"])
            {
                Affiliate = configuration["Pricing:AffiliateId"],
            };

            service = new PricingServiceApi(context, true);
        }
Esempio n. 2
0
        public void Authentication_IfBadCredentials_Exception401()
        {
            var apiContext = new ApiContext(Environments.QA, "admin", "invalid_password");

            service = new PricingServiceApi(apiContext);

            var exception = Assert.Catch <ApiException>(() =>
            {
                service.AuthenticationService.Authenticate();
            });

            Assert.AreEqual(HttpStatusCode.Unauthorized, exception.ResponseCode);
        }
Esempio n. 3
0
        public static void TestPricingService()
        {
            var apiKey = "access_token"; // it's too big for Console.ReadLine()
            var contextPricingService = new ApiContext(Environments.QA, apiKey);

            var pricingApi = new PricingServiceApi(contextPricingService);

            Console.WriteLine();
            Console.WriteLine(" ========================================================== ");
            Console.WriteLine(" Test: Get exchange rates");
            Console.WriteLine(" ========================================================== ");
            var rates = pricingApi.GetExchangeRates(null);

            foreach (var a in rates)
            {
                Console.WriteLine($"{a.baseCurrency} -> {a.targetCurrency}: {a.rate}, {a.encoreRate}, {a.protectionMargin}");
            }
        }