public async Task find_block_by_hash_should_invoke_blockchain_bridge_find_block_by_hash() { var block = Build.A.Block.TestObject; _blockFinder.FindBlock(block.Hash).Returns(block); var result = await _ndmBridge.FindBlockAsync(block.Hash); _blockFinder.Received().FindBlock(block.Hash); result.Should().Be(block); }
public void GetGasPricesFromRecentBlocks_IfEightBlocksWithTwoTransactions_CheckEightBlocks() { int blockNumber = 8; IBlockFinder blockFinder = BuildTree(blockNumber); ISpecProvider specProvider = Substitute.For <ISpecProvider>(); GasPriceOracle testGasPriceOracle = new(blockFinder, specProvider); testGasPriceOracle.GetGasPriceEstimate(); foreach (long receivedBlockNumber in Enumerable.Range(0, blockNumber + 1)) { blockFinder.Received(1).FindBlock(Arg.Is <long>(l => l == receivedBlockNumber)); } }
public void GetGasPricesFromRecentBlocks_IfLastFiveBlocksWithThreeTxAndFirstFourWithOne_CheckSixBlocks() { IBlockFinder blockFinder = GetBlockFinderForLastFiveBlocksWithThreeTxAndFirstFourWithOne(); GasPriceOracle testGasPriceOracle = new(blockFinder, Substitute.For <ISpecProvider>()) { IgnoreUnder = 1, BlockLimit = 6 }; testGasPriceOracle.GetGasPriceEstimate(); foreach (long receivedBlockNumber in Enumerable.Range(3, 5)) { blockFinder.Received(1).FindBlock(Arg.Is <long>(l => l == receivedBlockNumber)); } blockFinder.DidNotReceive().FindBlock(Arg.Is <long>(l => l <= 2)); }