private static async Task GetLatestRates(RatesExchangeApiService client, string baseCurrency, List <string> currencies) { Console.WriteLine("-- Get latest rates from ECB"); var parsed = JsonConvert.SerializeObject(await client.GetLatestRates(baseCurrency, currencies), Formatting.Indented); Console.WriteLine(parsed); }
public async Task CanGetLatestRates() { var client = new RatesExchangeApiService(ApiKey); var currencies = new List <string> { "USD", "CHF", "GBP" }; var result = await client.GetLatestRates(BaseCurrency, currencies); Assert.That(result, Is.Not.Null); Assert.That(result.Rates, Is.Not.Null); }
public void EmptyApiKeyThrowsException() { var client = new RatesExchangeApiService(string.Empty); Assert.That(async() => await client.GetLatestRates(BaseCurrency), Throws.InvalidOperationException); }