Do not hammer CoinGecko with tests

This commit is contained in:
nicolas.dorier 2020-01-17 14:56:05 +09:00
parent ff11e6e032
commit 827b6085af
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 10 additions and 2 deletions

View file

@ -18,6 +18,14 @@ namespace BTCPayServer.Services.Rates
public string Exchange { get; set; }
public string ExchangeName => Exchange ?? CoinGeckoName;
public bool CoinGeckoRate
{
get
{
return ExchangeName == CoinGeckoName;
}
}
public CoinGeckoRateProvider(IHttpClientFactory httpClientFactory)
{
if (httpClientFactory == null)
@ -31,7 +39,7 @@ namespace BTCPayServer.Services.Rates
public virtual Task<ExchangeRates> GetRatesAsync(CancellationToken cancellationToken)
{
return ExchangeName == CoinGeckoName ? GetCoinGeckoRates() : GetCoinGeckoExchangeSpecificRates();
return CoinGeckoRate ? GetCoinGeckoRates() : GetCoinGeckoExchangeSpecificRates();
}
private async Task<ExchangeRates> GetCoinGeckoRates()

View file

@ -2684,7 +2684,7 @@ noninventoryitem:
var all = string.Join("\r\n", factory.GetSupportedExchanges().Select(e => e.Id).ToArray());
foreach (var result in factory
.Providers
.Where(p => p.Value is BackgroundFetcherRateProvider)
.Where(p => p.Value is BackgroundFetcherRateProvider bf && !(bf.Inner is CoinGeckoRateProvider cg && !cg.CoinGeckoRate))
.Select(p => (ExpectedName: p.Key, ResultAsync: p.Value.GetRatesAsync(default), Fetcher: (BackgroundFetcherRateProvider)p.Value))
.ToList())
{