Esempio n. 1
0
        public void _04_Creer_une_classe_ShoppingCard_avec_une_methode_AddItem()
        {
            ShoppingCard shoppingCard = new ShoppingCard();

            shoppingCard.AddItem("apple", 10);
            shoppingCard.AddItem("banana", 10);

            Assert.NotNull(shoppingCard);
        }
Esempio n. 2
0
        public void _05_Creer_une_methode_Pay_qui_prend_en_paramètre_une_strategie_de_paiement()
        {
            ShoppingCard shoppingCard = new ShoppingCard();

            shoppingCard.AddItem("apple", 10);
            shoppingCard.AddItem("banana", 10);

            string transaction = shoppingCard.Pay(new CreditCard());

            Assert.Equal("20 has been charged to my credit card", transaction);

            shoppingCard = new ShoppingCard();

            shoppingCard.AddItem("Manga", 15);

            transaction = shoppingCard.Pay(new Paypal());

            Assert.Equal("15 has been charged to my paypal account", transaction);
        }