Ejemplo n.º 1
0
    public void AddMoneyToCard(PaymentCard card, double sum)
    {
      // ...
      money = money + sum;
      card.AddMoney(sum);

    }
Ejemplo n.º 2
0
 public void AddMoneyToCard(PaymentCard card, double sum)
 {
     if (this.money >= sum)
     {
         card.AddMoney(sum);
         this.money = this.money + sum;
     }
 }
Ejemplo n.º 3
0
        public void AddMoneyToCard(PaymentCard card, double sum)
        {

            // ...
            card.AddMoney(sum);
            this.money = this.money + sum;

        }
Ejemplo n.º 4
0
        public void TestCardAddMoney()
        {
            PaymentCard card = new PaymentCard(10);

            card.AddMoney(5);

            Assert.AreEqual(15, card.balance, "AddMoney should increase the balance by the amount!");
        }
 public void AddMoneyToCard(PaymentCard card, double sum)
 {
     if (money - sum >= 0)
     {
         money -= sum;
         card.AddMoney(sum);
     }
 }
 public void AddMoneyToCard(PaymentCard card, double sum)
 {
     if (sum < 0)
     {
         return;
     }
     card.AddMoney(sum);
     this.money += sum;
 }
Ejemplo n.º 7
0
        public void TestAddMoney()
        {
            {
                PaymentCard card = new PaymentCard(10);
                card.AddMoney(20);

                // Assert
                Assert.AreEqual("The card has a balance of 30 euros", card.ToString(), "Money should add up!");
            }
        }
Ejemplo n.º 8
0
        public void TestAddNegativeMoney()
        {
            {
                PaymentCard card = new PaymentCard(10);
                card.AddMoney(-5);

                // Assert
                Assert.AreEqual("The card has a balance of 10 euros", card.ToString(), "You cannot add negative money!");
            }
        }
Ejemplo n.º 9
0
        public void TestAddTooMuchMoney()
        {
            {
                PaymentCard card = new PaymentCard(10);
                card.AddMoney(200);

                // Assert
                Assert.AreEqual("The card has a balance of 150 euros", card.ToString(), "Balance should top up at 150!");
            }
        }
Ejemplo n.º 10
0
 public void AddMoneyToCard(PaymentCard card, double sum)
 {
     card.AddMoney(sum);
 }