public override void Undo() { if (!Succeeded) { return; } transaction.Undo(); Undone = transaction.Undone; base.Undo(); }
public void BuyTransaction_UndoProductPurchase_Success() { const decimal amount = 10; Product product = Substitute.For <Product>("Milk", amount); User user = Substitute.For <User>(userArgs); user.Balance = amount; BuyTransaction transaction = new BuyTransaction(user, product); transaction.Execute(); transaction.Undo(); Assert.That(transaction.Undone, Is.True); Assert.That(user.Balance, Is.EqualTo(amount)); }