Пример #1
0
        public void GetGasPricesFromRecentBlocks_IfBlockHasMoreThanThreeValidTx_AddOnlyThreeNew()
        {
            IBlockFinder blockFinder = Substitute.For <IBlockFinder>();
            Transaction  tx          = Build.A.Transaction.WithGasPrice(2).TestObject;
            Block        headBlock   = Build.A.Block.Genesis.WithTransactions(tx, tx, tx, tx, tx).TestObject;

            blockFinder.FindHeadBlock().Returns(headBlock);
            blockFinder.FindBlock(0).Returns(headBlock);
            GasPriceOracle testGasPriceOracle = new(blockFinder, Substitute.For <ISpecProvider>());

            IEnumerable <UInt256> results = testGasPriceOracle.GetSortedGasPricesFromRecentBlocks(0);

            results.Count().Should().Be(3);
        }
Пример #2
0
 public Block FindHeadBlock() => _blockFinder.FindHeadBlock();