public void BasicSpending()
{
// We'll set up a wallet that receives a coin, then sends a coin of lesser value and keeps the change.
var v1 = Utils.ToNanoCoins(1, 0);
var t1 = TestUtils.CreateFakeTx(_params, v1, _myAddress);
_wallet.Receive(t1, null, BlockChain.NewBlockType.BestChain);
Assert.AreEqual(v1, _wallet.GetBalance());
Assert.AreEqual(1, _wallet.GetPoolSize(Wallet.Pool.Unspent));
Assert.AreEqual(1, _wallet.GetPoolSize(Wallet.Pool.All));
var k2 = new EcKey();
var v2 = Utils.ToNanoCoins(0, 50);
var t2 = _wallet.CreateSend(k2.ToAddress(_params), v2);
Assert.AreEqual(1, _wallet.GetPoolSize(Wallet.Pool.Unspent));
Assert.AreEqual(1, _wallet.GetPoolSize(Wallet.Pool.All));
// Do some basic sanity checks.
Assert.AreEqual(1, t2.Inputs.Count);
Assert.AreEqual(_myAddress, t2.Inputs[0].ScriptSig.FromAddress);
// We have NOT proven that the signature is correct!
_wallet.ConfirmSend(t2);
Assert.AreEqual(1, _wallet.GetPoolSize(Wallet.Pool.Pending));
Assert.AreEqual(1, _wallet.GetPoolSize(Wallet.Pool.Spent));
Assert.AreEqual(2, _wallet.GetPoolSize(Wallet.Pool.All));
}