Пример #1
0
        public void Account_withdraw_without_balance()
        {
            //arrange
            Account a          = new Everyday(200);
            decimal withdrawal = 500;

            string actual;

            //act
            try
            {
                actual = a.Withdraw(withdrawal);
                Assert.Fail(); // will not reach here if correct
            }
            catch (Exception e)
            {
                actual = e.Message;
            }

            string expected = "Everyday " + a.ID.ToString() + "; withdrawal $500; transaction failed; balance $200";


            //assert
            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void Account_withdraw_with_balance()
        {
            //arrange
            Account a          = new Everyday(1000);
            decimal withdrawal = 200;

            //act
            a.Withdraw(withdrawal);

            //assert
            decimal expected = 800;
            decimal actual   = a.Balance;

            Assert.AreEqual(expected, actual);
        }