public ConsumerServicesBackgroundProcessor( IAccountService accountService, IRefundClaimant refundClaimant, IDepositConfirmationService depositConfirmationService, IEthPriceService ethPriceService, IDaiPriceService daiPriceService, IGasPriceService gasPriceService, IBlockProcessor blockProcessor, IDepositDetailsRepository depositRepository, IConsumerNotifier consumerNotifier, ILogManager logManager, bool useDepositTimer = false, IEthJsonRpcClientProxy?ethJsonRpcClientProxy = null, uint depositTimer = 10000) { _accountService = accountService; _refundClaimant = refundClaimant; _depositConfirmationService = depositConfirmationService; _ethPriceService = ethPriceService; _daiPriceService = daiPriceService; _gasPriceService = gasPriceService; _blockProcessor = blockProcessor; _depositRepository = depositRepository; _consumerNotifier = consumerNotifier; _useDepositTimer = useDepositTimer; _ethJsonRpcClientProxy = ethJsonRpcClientProxy; _logger = logManager.GetClassLogger(); _ethPriceService.UpdateAsync(); _daiPriceService.UpdateAsync(); _gasPriceService.UpdateAsync(); _depositTimerPeriod = depositTimer; }
public async Task update_async_should_set_usd_price() { const decimal price = 187; var results = new[] { new EthPriceService.Result { PriceUsd = price } }; _client.GetAsync <EthPriceService.Result[]>(Arg.Any <string>()).ReturnsForAnyArgs(results); await _ethPriceService.UpdateAsync(); _ethPriceService.UsdPrice.Should().Be(price); _ethPriceService.UpdatedAt.Should().Be(_timestamper.EpochSeconds); await _client.ReceivedWithAnyArgs().GetAsync <EthPriceService.Result[]>(Arg.Any <string>()); }
public async Task update_async_should_set_usd_price() { const decimal price = 187; var results = new Dictionary <string, EthPriceService.Result> { { "USDT_ETH", new EthPriceService.Result { PriceUsd = price } } }; _client.GetAsync <Dictionary <string, EthPriceService.Result> >(Arg.Any <string>()).ReturnsForAnyArgs(results); await _ethPriceService.UpdateAsync(); _ethPriceService.UsdPrice.Should().Be(price); _ethPriceService.UpdatedAt.Should().Be(_timestamper.UnixTime.Seconds); await _client.ReceivedWithAnyArgs().GetAsync <Dictionary <string, EthPriceService.Result> >(Arg.Any <string>()); }