Пример #1
0
        public async Task GetTimeframe()
        {
            var today     = DateTime.Now;
            var yesterday = today.AddDays(-1);

            var res = await Api.Currency.GetTimeframe("USD", yesterday, today, "EUR");

            Assert.AreEqual("USD", res.Currency);
            Assert.AreEqual("EUR", res.Base);
            Assert.AreEqual(2, res.Timespan);
            Assert.AreEqual(2, res.Rates.Count);
            Spew.Dump(res);
        }
Пример #2
0
        public async Task GetHistoricalCurrency()
        {
            var yesterday = DateTime.Now.AddDays(-1);

            var res = await Api.Currency.GetHistoricalAsync(yesterday);

            Assert.AreEqual("USD", res.Base);

            res = await Api.Currency.GetHistoricalAsync(yesterday, "EUR", new string[] { "EUR", "GBP", "USD" });

            Assert.AreEqual("EUR", res.Base);
            Spew.Dump(res);
        }
Пример #3
0
        public async Task GetUsage()
        {
            try
            {
                var usage = await Api.Usage.GetAsync();

                Assert.AreNotEqual(0, usage.Requests["geoip"]);
                Spew.Dump(usage);
            }
            catch (ResponseException ex)
            {
                Console.WriteLine("ResponseException: " + ex.Message + " - status: " + ex.Status.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
            }
        }