Exemplo n.º 1
0
 public void CanHandleOptionalArguments()
 {
     EthereumJsonSerializer serializer = new EthereumJsonSerializer();
     string serialized = serializer.Serialize(new TransactionForRpc());
     IEthRpcModule ethRpcModule = Substitute.For<IEthRpcModule>();
     ethRpcModule.eth_call(Arg.Any<TransactionForRpc>()).ReturnsForAnyArgs(x => ResultWrapper<string>.Success("0x1"));
     JsonRpcSuccessResponse response = TestRequest(ethRpcModule, "eth_call", serialized) as JsonRpcSuccessResponse;
     Assert.AreEqual("0x1", response?.Result);
 }
        public void Eth_call_is_working_with_explicit_null_as_the_last_argument(string nullValue)
        {
            EthereumJsonSerializer serializer   = new();
            IEthRpcModule          ethRpcModule = Substitute.For <IEthRpcModule>();

            ethRpcModule.eth_call(Arg.Any <TransactionForRpc>(), Arg.Any <BlockParameter?>()).ReturnsForAnyArgs(x => ResultWrapper <string> .Success("0x"));

            string serialized = serializer.Serialize(new TransactionForRpc());

            JsonRpcSuccessResponse response = TestRequest(ethRpcModule, "eth_call", serialized, nullValue) as JsonRpcSuccessResponse;

            Assert.AreEqual("0x", response?.Result);
        }