public void should_simple_synchronous_call_getblock_height_with_bad_height_throws_exception() { BlockClient client = new BlockClient(); ExceptionWithMessage <BlockError> typedException = null; try { client.GetBlock(Network.Doge, -1); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <BlockError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); }
public void should_simple_synchronous_call_getspenttx_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressAfterTxError> typedException = null; try { client.GetSpentTx(Network.Doge, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressAfterTxError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.AfterTx == "Retrieve 100 transactions that occurred after this transaction ID"); }
public void should_simple_synchronous_call_getreceivedtx_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressAfterTxError> typedException = null; try { client.GetReceivedTx(Network.Doge, Consts.Wrong, "e83d147c3bcd87c6efd5270896a179f6ecb1de8b8c8cc324645c5a14129baf8c"); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressAfterTxError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.AfterTx == "Return 100 transactions that occurred after this Transaction ID"); }
public void should_simple_synchronous_call_getspentvalue_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressSentValueError> typedException = null; try { client.GetSpentValue(Network.Doge, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressSentValueError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.Address == Consts.ValidAddressRequired); }
public void should_simple_synchronous_call_getbalance_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressError> typedException = null; try { client.GetBalance(Network.Doge, Consts.Wrong, 1000000); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.Address == "A valid address is required"); }
public void should_simple_synchronous_call_getshortaddress_with_bad_address_throws_exception() { SimpleClient client = new SimpleClient(); ExceptionWithMessage <CommonError> typedException = null; try { client.GetShortAddress(Network.BitcoinTest, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <CommonError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Code == 404); Assert.IsTrue(typedException.ErrorMessage.Message == "Invalid long/short address"); }
public void should_simple_synchronous_call_gettx_with_bad_address_throws_exception() { TransactionClient client = new TransactionClient(); ExceptionWithMessage <TxidError> typedException = null; try { client.GetTx(Network.Doge, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <TxidError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.Txid == Consts.ValidTxHashRequired); }
public void should_simple_synchronous_call_istxconfirmed_with_bad_address_throws_exception() { TransactionClient client = new TransactionClient(); ExceptionWithMessage <TxidError> typedException = null; try { client.IsTxConfirmed(Network.Doge, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <TxidError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); string withUppercaseFirst = Consts.ValidTxHashRequired.First().ToString().ToUpper() + String.Join("", Consts.ValidTxHashRequired.ToLower().Skip(1)); Assert.IsTrue(typedException.ErrorMessage.Data.Txid == withUppercaseFirst); }