public async Task RpcNotEnoughEstimationsAsync() { var rpc = new MockRpcClient(); rpc.OnGetBlockchainInfoAsync = async() => await Task.FromResult(new BlockchainInfo { Blocks = 100, Headers = 100 }); rpc.OnGetPeersInfoAsync = async() => await Task.FromResult(Array.Empty <PeerInfo>()); rpc.OnGetMempoolInfoAsync = async() => await Task.FromResult(new MemPoolInfo { MemPoolMinFee = 0.00001000 // 1 s/b (default value) }); rpc.OnEstimateSmartFeeAsync = (target, _) => throw new NoEstimationException(target); await Assert.ThrowsAsync <NoEstimationException>(async() => await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative)); }
public async Task RpcFailuresAsync() { var rpc = new MockRpcClient(); rpc.OnGetBlockchainInfoAsync = () => throw new RPCException(RPCErrorCode.RPC_CLIENT_NOT_CONNECTED, "Error-GetBlockchainInfo", null); rpc.OnEstimateSmartFeeAsync = (target, _) => throw new RPCException(RPCErrorCode.RPC_CLIENT_NOT_CONNECTED, "Error-EstimateSmartFee", null); rpc.OnGetMempoolInfoAsync = async() => await Task.FromResult(new MemPoolInfo { MemPoolMinFee = 0.00001000 // 1 s/b (default value) }); var ex = await Assert.ThrowsAsync <RPCException>(async() => await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative)); Assert.Equal(RPCErrorCode.RPC_CLIENT_NOT_CONNECTED, ex.RPCCode); Assert.Equal("Error-EstimateSmartFee", ex.Message); }