コード例 #1
0
        public override void Undo()
        {
            if (!Succeeded)
            {
                return;
            }

            transaction.Undo();
            Undone = transaction.Undone;

            base.Undo();
        }
コード例 #2
0
        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));
        }