private async Task <string> GenerateReport(ReportConfig cfg) { var report = new StringBuilder(); report .AppendLine("Your Daily Report") .AppendLine("-----------------------") .AppendLine($"Generated at {DateTimeOffset.UtcNow}") .AppendLine("-----------------------"); var elements = cfg.ReportElements; foreach (var e in elements) { var(key, value) = e; if (key.Equals("CryptoPriceUSD")) { report.AppendLine($"{key} - {value}: {Math.Round(await _coinApi.GetSymbolUsdPrice(value), 0)}"); } else { report.AppendLine($"Unknown Report Element: {key} - {value}"); } } return(report.ToString()); }
public async Task CoinApi_GetCurrentEthPrice() { var api = new CoinApi(); var price = await api.GetSymbolUsdPrice("ETH"); Assert.IsTrue(price > 0); }