public void UnconfirmedState()
        {
            var          wtx = GenerateWalletTransaction();
            ITransaction tx  = new JetTransactionModel(wtx);

            var expected = TxState.Unconfirmed;

            Assert.AreEqual(expected, tx.State);
        }
        public void ConfirmationsNone()
        {
            var          wtx = GenerateWalletTransaction();
            ITransaction tx  = new JetTransactionModel(wtx);

            var expected = 0;

            Assert.AreEqual(expected, tx.Confirmations);
        }
        public void NoBlockHeight()
        {
            var          wtx = GenerateWalletTransaction();
            ITransaction tx  = new JetTransactionModel(wtx);

            var expected = -1;

            Assert.AreEqual(expected, tx.BlockHeight);
        }
        public void GetBlockHashEmpty()
        {
            var          wtx = GenerateWalletTransaction();
            ITransaction tx  = new JetTransactionModel(wtx);

            var expected = "NA";

            Assert.AreEqual(expected, tx.BlockHash);
        }
        public void GetId()
        {
            var wtx = GenerateWalletTransaction();

            wtx.Transaction = _tx;
            ITransaction tx = new JetTransactionModel(wtx);

            var expected = TX_HASH;

            Assert.AreEqual(expected, tx.Id);
        }
        public void SentAction()
        {
            var          sent     = 2000;
            var          received = 1200;
            var          wtx      = GenerateWalletTransaction(sent, received);
            ITransaction tx       = new JetTransactionModel(wtx);

            var expected = TxAction.Sent;

            Assert.AreEqual(expected, tx.Action);
        }
        public void AmountBTC()
        {
            var          sent     = 1200;
            var          received = 200;
            var          wtx      = GenerateWalletTransaction(sent, received);
            ITransaction tx       = new JetTransactionModel(wtx);

            var expected = new Money(received - sent);

            Assert.AreEqual(expected, tx.AmountBTC);
        }
        public void DateFromTx()
        {
            var wtx = GenerateWalletTransaction();

            wtx.Transaction = _tx;
            ITransaction tx = new JetTransactionModel(wtx);

            var expected = wtx.AddedDate.Date;

            Assert.AreEqual(expected, tx.Date);
        }
        public void AmountCurr()
        {
            var          sent     = 1200;
            var          received = 200;
            var          wtx      = GenerateWalletTransaction(sent, received);
            ITransaction tx       = new JetTransactionModel(wtx);

            var balance  = new Money(received - sent);
            var expected = JetMoneyTools.CalcBtc2Curr(balance);

            Assert.AreEqual(expected, tx.AmountCurr);
        }
        public void DateFromBlock()
        {
            var wtx       = GenerateWalletTransaction();
            var blockInfo = new BlockInformation();

            blockInfo.Header     = _block.Header;
            wtx.BlockInformation = blockInfo;
            ITransaction tx = new JetTransactionModel(wtx);

            var expected = blockInfo.Header.BlockTime.Date;

            Assert.AreEqual(expected, tx.Date);
        }
        public void GetBlockHash()
        {
            var wtx       = GenerateWalletTransaction();
            var blockInfo = new BlockInformation();

            blockInfo.Header     = _block.Header;
            wtx.BlockInformation = blockInfo;
            ITransaction tx = new JetTransactionModel(wtx);

            var expected = BLOCK_HASH;

            Assert.AreEqual(expected, tx.BlockHash);
        }
        public void ConfirmedState()
        {
            var wtx                 = GenerateWalletTransaction();
            var blockInfo           = new BlockInformation();
            var enoughConfirmations = 8; // >= 6 is enough

            blockInfo.Confirmations = enoughConfirmations;
            wtx.BlockInformation    = blockInfo;
            ITransaction tx = new JetTransactionModel(wtx);

            var expected = TxState.Confirmed;

            Assert.AreEqual(expected, tx.State);
        }
        public void AwaitingState()
        {
            var wtx       = GenerateWalletTransaction();
            var blockInfo = new BlockInformation();
            var notEnoughConfirmations = 1;

            blockInfo.Confirmations = notEnoughConfirmations;
            wtx.BlockInformation    = blockInfo;
            ITransaction tx = new JetTransactionModel(wtx);

            var expected = TxState.Awaiting;

            Assert.AreEqual(expected, tx.State);
        }
        public void ConfirmationsOK()
        {
            var wtx       = GenerateWalletTransaction();
            var blockInfo = new BlockInformation();

            blockInfo.Header        = _block.Header;
            blockInfo.Confirmations = 1000;
            wtx.BlockInformation    = blockInfo;
            ITransaction tx = new JetTransactionModel(wtx);

            var greaterThan = 0;

            Assert.Greater(tx.Confirmations, greaterThan);
        }