Ejemplo n.º 1
0
        public void UnconfirmedState()
        {
            var          wtx = GenerateWalletTransaction();
            ITransaction tx  = new JetTransactionModel(wtx);

            var expected = TxState.Unconfirmed;

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

            var expected = 0;

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

            var expected = -1;

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

            var expected = "NA";

            Assert.AreEqual(expected, tx.BlockHash);
        }
Ejemplo n.º 5
0
        public void GetId()
        {
            var wtx = GenerateWalletTransaction();

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

            var expected = TX_HASH;

            Assert.AreEqual(expected, tx.Id);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public void DateFromTx()
        {
            var wtx = GenerateWalletTransaction();

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

            var expected = wtx.AddedDate.Date;

            Assert.AreEqual(expected, tx.Date);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }