public async Task <double> GetResult(double originalValue, string fromCurrency, string toCurrency) { try { var res = await _apiService.GetLatestRates(_accessToken, $"{fromCurrency},{toCurrency}", 1).ConfigureAwait(false); return(res.Quotes[res.Source + toCurrency] / res.Quotes[res.Source + fromCurrency] * originalValue); } catch (Exception e) { return(0); } }
public void TestLatestRatesEurJpy() { var ratesTask = _apiService.GetLatestRates(AccessKey, "EUR,JPY", 1); ratesTask.Wait(); var result = ratesTask.Result; Assert.AreNotEqual(result, null); Assert.AreNotEqual(result.Quotes, null); Assert.AreNotEqual(result.Quotes.Count, 0); }