BitSharper.Test.WalletTest.Transactions C# (CSharp) Method

Transactions() private method

private Transactions ( ) : void
return void
        public void Transactions()
        {
            // This test covers a bug in which Transaction.getValueSentFromMe was calculating incorrectly.
            var tx = TestUtils.CreateFakeTx(_params, Utils.ToNanoCoins(1, 0), _myAddress);
            // Now add another output (ie, change) that goes to some other address.
            var someOtherGuy = new EcKey().ToAddress(_params);
            var output = new TransactionOutput(_params, tx, Utils.ToNanoCoins(0, 5), someOtherGuy);
            tx.AddOutput(output);
            // Note that tx is no longer valid: it spends more than it imports. However checking transactions balance
            // correctly isn't possible in SPV mode because value is a property of outputs not inputs. Without all
            // transactions you can't check they add up.
            _wallet.Receive(tx, null, BlockChain.NewBlockType.BestChain);
            // Now the other guy creates a transaction which spends that change.
            var tx2 = new Transaction(_params);
            tx2.AddInput(output);
            tx2.AddOutput(new TransactionOutput(_params, tx2, Utils.ToNanoCoins(0, 5), _myAddress));
            // tx2 doesn't send any coins from us, even though the output is in the wallet.
            Assert.AreEqual(Utils.ToNanoCoins(0, 0), tx2.GetValueSentFromMe(_wallet));
        }