Exemplo n.º 1
0
        public void GoldCardMayHaveNegativeCredit()
        {
            int      cardId   = 1;
            string   name     = "Customer1";
            string   address  = "Address1";
            string   city     = "City1";
            decimal  credit   = 100;
            decimal  toPay    = credit + 1000;
            decimal  discount = 10;
            GoldCard card     = new GoldCard(cardId, name, address, city, credit, discount);

            card.Pay(toPay);
            Assert.IsTrue(card.Credit < 0);
        }
Exemplo n.º 2
0
        public void GoldCard_WhenPaying_DiscountIsConsidered()
        {
            int      cardId         = 1;
            string   name           = "Customer1";
            string   address        = "Address1";
            string   city           = "City1";
            decimal  credit         = 100;
            decimal  toPay          = 10;
            decimal  discount       = 10;
            decimal  expectedToPay  = toPay - (toPay * discount / 100);
            decimal  expectedCredit = credit - expectedToPay;
            GoldCard card           = new GoldCard(cardId, name, address, city, credit, discount);

            card.Pay(toPay);
            Assert.AreEqual(expectedCredit, card.Credit);
        }