btcpayserver/BTCPayServer.Tests/Mocks/MockRateProvider.cs
Kukks 58d9a48787
CoinGecko Rate Provider
The CoinGecko rate provider is similar to the bitcoin average one, in that you can ask it for a rate from its aggregated sourcing or you can get rates from specific exchanges. I've added support for both.
I haven't integrated it or replaced coinaverage just to see if we should use it as the default and switch everyone to it or what other action to take.
2020-01-13 20:20:00 +09:00

31 lines
963 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Rating;
using BTCPayServer.Services.Rates;
namespace BTCPayServer.Tests.Mocks
{
public class MockRateProvider : CoinGeckoRateProvider
{
public ExchangeRates ExchangeRates { get; set; } = new ExchangeRates();
public List<AvailableRateProvider> AvailableRateProviders { get; set; } = new List<AvailableRateProvider>();
public MockRateProvider():base(null)
{
}
public override Task<ExchangeRates> GetRatesAsync(CancellationToken cancellationToken)
{
return Task.FromResult(ExchangeRates);
}
public override Task<IEnumerable<AvailableRateProvider>> GetAvailableExchanges(bool reload = false)
{
return Task.FromResult((IEnumerable<AvailableRateProvider>)AvailableRateProviders);
}
}
}