Beispiel #1
0
 public void Eth_module_populates_size_when_returning_block_data()
 {
     IEthRpcModule ethRpcModule = Substitute.For<IEthRpcModule>();
     ISpecProvider specProvider = Substitute.For<ISpecProvider>();
     ethRpcModule.eth_getBlockByNumber(Arg.Any<BlockParameter>(), true).ReturnsForAnyArgs(x => ResultWrapper<BlockForRpc>.Success(new BlockForRpc(Build.A.Block.WithNumber(2).TestObject, true, specProvider)));
     JsonRpcSuccessResponse response = TestRequest(ethRpcModule, "eth_getBlockByNumber", "0x1b4", "true") as JsonRpcSuccessResponse;
     Assert.AreEqual(513L, (response?.Result as BlockForRpc)?.Size);
 }
Beispiel #2
0
        public void GetBlockByNumberTest()
        {
            IEthRpcModule ethRpcModule = Substitute.For <IEthRpcModule>();

            ethRpcModule.eth_getBlockByNumber(Arg.Any <BlockParameter>(), true).ReturnsForAnyArgs(x => ResultWrapper <BlockForRpc> .Success(new BlockForRpc(Build.A.Block.WithNumber(2).TestObject, true)));
            JsonRpcSuccessResponse response = TestRequest(ethRpcModule, "eth_getBlockByNumber", "0x1b4", "true") as JsonRpcSuccessResponse;

            Assert.AreEqual(2L, (response?.Result as BlockForRpc)?.Number);
        }