示例#1
0
        /// <summary>
        /// Returns a page with exchange rates
        /// Authorization required.
        /// </summary>
        /// <returns>Exchange rates.</returns>
        public ResponseForPage <ExchangeRate> GetExchangeRates(ExchangeRatesParameters parameters)
        {
            var result = Executor.ExecuteApiWithWrappedResponse <ResponseForPage <ExchangeRate> >(
                "v2/admin/exchange_rates",
                RequestMethod.Get,
                query: parameters,
                dateFormat: DateFormat);

            return(result.DataOrException);
        }
        /// <inheritdoc />
        public ResponseForPage <ExchangeRate> GetExchangeRates(ExchangeRatesParameters ratesParameters)
        {
            TriggerAutomaticAuthentication();
            var parameters = new ExecuteApiRequestParameters
            {
                Endpoint   = $"v{ApiVersion}/admin/exchange_rates",
                Method     = RequestMethod.Get,
                Query      = ratesParameters,
                DateFormat = DateFormat,
            };
            var result = Executor.ExecuteApiWithWrappedResponse <ResponseForPage <ExchangeRate> >(parameters);

            return(result.DataOrException);
        }
示例#3
0
        public void GetExchangeRates_CorrectlySorts()
        {
            var parameters = new ExchangeRatesParameters
            {
                Direction = Direction.Asc,
            };

            var rates = service.GetExchangeRates(parameters);

            AssertRatesAreValid(rates);
            CollectionAssert.AreEqual(
                rates.OrderBy(r => r.DatetimeOfSourcing).Select(r => r.DatetimeOfSourcing).ToList(),
                rates.Select(r => r.DatetimeOfSourcing).ToList());
        }