コード例 #1
0
        public void InjectingIntoConstructors()
        {
            var dollar            = new Dollar();
            var epayment          = new ElectronicPayment(1.50m);
            var firstTransaction  = new Transaction(dollar);
            var secondTransaction = new Transaction(epayment);

            Console.WriteLine(firstTransaction.GetTransactionType());
            Console.WriteLine(secondTransaction.GetTransactionType());

            Assert.AreEqual("Dollar", firstTransaction.GetTransactionType());
            Assert.AreEqual(1.50m, secondTransaction.GetTransactionAmount());
        }
コード例 #2
0
        public void DollarTest()             //change it to Dollar since we doing that test
        {
            ICurrency dollar = new Dollar(); //newing the ICurrency to Dollar

            Assert.AreEqual(1m, dollar.Value);
        }