コード例 #1
0
        public void WithdrawWithValidAmountOmni()
        {
            float initialBalance = 200;
            float withdrawAmount = 50;
            float expected       = 150;

            Customer    customer    = new Customer(4, "Allen", "02222222");
            OmniAccount omniAccount = new OmniAccount(customer, 5, initialBalance, 5, 20, 1000);

            float actual = omniAccount.Withdraw(withdrawAmount);

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void WithdrawWithLessThanZeroOmni()
        {
            float initialBalance = 200;
            float withdrawAmount = -10;

            Customer    customer    = new Customer(4, "Allen", "02222222");
            OmniAccount omniAccount = new OmniAccount(customer, 5, initialBalance, 5, 20, 1000);

            try
            {
                omniAccount.Withdraw(withdrawAmount);
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
            Assert.Fail();
        }