コード例 #1
0
        public void Account_withdraw_within_overdraft_limit()
        {
            //arrange
            Account a = new Omni(1000, (decimal).10, 10, 100);

            //act
            a.Withdraw(1050);

            //assert
            decimal expected = -50;
            decimal actual   = a.Balance;

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void Account_withdraw_outside_overdraft_limit()
        {
            //arrange
            Account a = new Omni(1000, (decimal).10, 10, 100);

            //act
            string actual;

            try
            {
                actual = a.Withdraw(1150);
                Assert.Fail(); // should throw exception, if code reaches here fail test
            }
            catch (Exception e)
            {
                actual = e.Message;
            }

            //assert
            string expected = "Omni " + a.ID.ToString() + "; withdrawal $1150; transaction failed; fee 10; balance $990";

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
 private void withdrawButton_Click(object sender, EventArgs e)
 {
     o.Withdraw(Convert.ToInt32(numericUpDown1.Text));
     textBox1.Text = o.WithdrawInfo(Convert.ToInt32(numericUpDown1.Text), o.accounttype);
 }