コード例 #1
0
        public void _02_Creer_une_classe_Paypal_avec_une_methode_Pay()
        {
            Paypal paypal = new Paypal();

            string transaction = paypal.Pay(10);

            Assert.Equal("10 has been charged to my paypal account", transaction);
        }
コード例 #2
0
        public void _03_Creer_une_interface_IPaiement_avec_une_methode_Pay_pour_unifier_CreditCard_et_Paypal()
        {
            IPayement creditCard = new CreditCard();

            string creditCardTransaction = creditCard.Pay(100);

            IPayement paypal = new Paypal();

            string paypalTransaction = paypal.Pay(1000);

            Assert.Equal("100 has been charged to my credit card", creditCardTransaction);

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