コード例 #1
0
        public void TestWithdraw_CashInsufficient()
        {
            var dataManager = new DataManager(new ATMEntities());

            dataManager.InsertCardAccount("1113335559", "9871", 200.0M);

            ATMOperationResult withdrawResult = dataManager.WithdrawMoney("1113335557", "9871", 200.0M);

            Assert.AreEqual(ATMOperationResult.CashInsufficient, withdrawResult);
        }
コード例 #2
0
        private static void Main()
        {
            var dataManager = new DataManager(new ATMEntities());

            ATMOperationResult withdrawResult = dataManager.WithdrawMoney("9273412345", "8356", 200);

            if (withdrawResult == ATMOperationResult.Success)
            {
                decimal cardCash;
                ATMOperationResult retrieveResult = dataManager.GetCardCash("9273412345", "8356", out cardCash);

                if (retrieveResult == ATMOperationResult.Success)
                {
                    Console.WriteLine("Remaining cash: {0:N2}", cardCash);
                }
            }
        }