Exemple #1
0
        public void CanHandleOptionalArguments()
        {
            EthereumJsonSerializer serializer = new EthereumJsonSerializer();
            string     serialized             = serializer.Serialize(new TransactionForRpc());
            IEthModule ethModule = Substitute.For <IEthModule>();

            ethModule.eth_call(Arg.Any <TransactionForRpc>()).ReturnsForAnyArgs(x => ResultWrapper <string> .Success("0x1"));
            JsonRpcSuccessResponse response = TestRequest(ethModule, "eth_call", serialized) as JsonRpcSuccessResponse;

            Assert.AreEqual("0x1", response?.Result);
        }
        public void CanHandleOptionalArguments()
        {
            EthereumJsonSerializer serializer = new EthereumJsonSerializer();
            string     serialized             = serializer.Serialize(new TransactionForRpc());
            IEthModule ethModule = Substitute.For <IEthModule>();

            ethModule.eth_call(Arg.Any <TransactionForRpc>()).ReturnsForAnyArgs(x => ResultWrapper <byte[]> .Success(new byte[] { 1 }));
            JsonRpcResponse response = TestRequest <IEthModule>(ethModule, "eth_call", serialized);

            Assert.AreEqual(1, (response.Result as byte[]).Length);
        }