public void DollarTest()
        {
            ICurrency dollar = new Dollar();

            Assert.AreEqual("Dollar", dollar.Name);
            Assert.AreEqual(1m, dollar.Value);
        }
Exemple #2
0
        public void InjectingIntoContructors()
        {
            var dollar            = new Dollar();
            var epayment          = new ElectronicPayment(52000m);
            var firstTransaction  = new Transaction(dollar);
            var secondTransaction = new Transaction(epayment);

            Console.WriteLine(firstTransaction.GetTransactionAmount());
            Console.WriteLine(secondTransaction.GetTransactionAmount());
        }
        public void InjectingIntoConstructors()
        {
            var dollar            = new Dollar();
            var ePayment          = new ElectronicPayment(123.4m);
            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("Electronic Payment", secondTransaction.GetTransactionType());
            Assert.AreEqual(123.4m, secondTransaction.GetAmount());
        }
Exemple #4
0
        public void PayDebtTest()
        {
            _debt = 9000.01m;

            var dollar = new Dollar();

            PayDebt(dollar);
            PayDebt(new Dime());
            PayDebt(new Penny());
            PayDebt(new ElectronicPayment(315.72m));

            // Starting Debt - whatever I paid above
            var expectedDebt = 9000.01m - 316.83m;

            Assert.AreEqual(expectedDebt, _debt);
        }
Exemple #5
0
        public void PayDebtTest()
        {
            _debt = 9000.01m;

            var dollar = new Dollar();

            // pay a dollar off using local var name
            PayDebt(dollar);
            // pay debt off by a dollar using new Dollar()
            PayDebt(new Dollar());
            // pay debt using the payment amount
            PayDebt(new ElectronicPayment(315.72m));

            // Starting Debt - Whatever I paid above
            var expectedDebt = 9000.01m - 317.72m;

            Assert.AreEqual(expectedDebt, _debt);
        }
Exemple #6
0
        public void InjectingIntoConstructors()
        {
            // Test data ICurrency objects
            var dollar   = new Dollar();
            var ePayment = new ElectronicPayment(234.15m);

            // New Up Transations with Test Data
            var firstTransaction  = new Transaction(dollar);
            var secondTransaction = new Transaction(ePayment);

            // Calling Methods
            Console.WriteLine(firstTransaction.GetTransactionType());
            Console.WriteLine(secondTransaction.GetTransactionType());

            Assert.AreEqual("Dollar", firstTransaction.GetTransactionType());
            Assert.AreEqual("Electronic Payment", secondTransaction.GetTransactionType());

            Assert.AreEqual(234.15m, secondTransaction.GetTransactionValue());
        }
Exemple #7
0
        public void PayDebtTest()
        {
            _debt = 9000.01m;

            //PayDebt(new Dollar());
            // ^^ same as:
            var dollar = new Dollar();

            PayDebt(dollar);
            PayDebt(new Dime());
            PayDebt(new Penny());
            PayDebt(new ElectronicPayment(315.72m));

            // Starting Debt - whatever I paid above
            var expectedDebt = 9000.01m - 316.83m;

            // we call PayDebt 4 times (dollar, dime, penny, and epayment) so that total = 316.83

            Assert.AreEqual(expectedDebt, _debt);
        }