public void Test_RPCInvalidParamsException() { var getBalance = new GetBalance(Consts.ApiUrl.TestNet); GetBalanceRequestMessage requestMessage = new GetBalanceRequestMessage("hx0000000000000000000000000000000000000000"); FieldInfo addressFieldInfo = requestMessage.Parameters.GetType().GetField("Address"); addressFieldInfo.SetValue(requestMessage.Parameters, "hxz000000000000000000000000000000000000000"); // 'hx0000000000000000000000000000000000000000' is correct Assert.ThrowsAsync(typeof(RPCInvalidParamsException), async() => await getBalance.Invoke(requestMessage)); }
public void Test_RPCMethodNotFoundException() { var getBalance = new GetBalance(Consts.ApiUrl.TestNet); GetBalanceRequestMessage requestMessage = new GetBalanceRequestMessage("hx0000000000000000000000000000000000000000"); FieldInfo methodFieldInfo = typeof(GetBalanceRequestMessage).GetField("Method"); methodFieldInfo.SetValue(requestMessage, "icx_GetBalance"); // 'icx_getBalance' is correct Assert.ThrowsAsync(typeof(RPCMethodNotFoundException), async() => await getBalance.Invoke(requestMessage)); }