static void Main(string[] args)
        {
            BankCard card1 = new BankCard();

            card1.SetCardNumber("123");
            card1.SetCardNumber("12345678");
            card1.AddMoney(50);
            card1.AddMoney(0.5);
            card1.PrintAccountBalance();
            card1.SubtractMoney(50);
            card1.PrintAccountBalance();
            card1.SubtractMoney(50);

            Console.WriteLine();

            BankCard card2 = new BankCard(100, "Visa");

            card2.SetCardNumber("xys");
            card2.SetCardNumber("87654321");
            card2.AddMoney(100);
            card2.PrintAccountBalance();
            card2.SubtractMoney(200);
            card2.PrintAccountBalance();
            card2.SubtractMoney(10);
        }
示例#2
0
        public void Test_BankCard()
        {
            BankCard card = rd.GetMoneyData(path_2, 1);

            Assert.AreEqual(640, card.GetMoney());

            card.AddMoney(123.456m);
            Assert.AreEqual(763.456m, card.GetMoney());

            decimal tmp_1 = card.GetMoney();

            card.WithdrawMoney(700);
            decimal tmp_2 = card.GetMoney();

            Assert.AreNotEqual(tmp_1, tmp_2);

            card.validDate = Convert.ToDateTime("01.01.1999");
            Assert.AreEqual(false, card.IsWork());
        }