public void EPaymentTests(double value)
        {
            var convertedValue = Convert.ToDecimal(value);
            var ePayment       = new ElectronicPayment(convertedValue);

            Assert.AreEqual(convertedValue, ePayment.Value);
            Assert.AreEqual("Electronic Payment", ePayment.Name);
        }
예제 #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 EPaymentTest(double value)
        {
            // var castedValue = (decimal)value;
            // ^casted is another way to write the conversion from the data row to the decimal, can also use Convert. as below
            var convertedValue = Convert.ToDecimal(value);
            var ePayment       = new ElectronicPayment(convertedValue);

            Assert.AreEqual(convertedValue, ePayment.Value);
            Assert.AreEqual("Electronic Payment", ePayment.Name);
        }
예제 #4
0
        public void EPaymentTests(double value)
        {
            // converting because DataRow does not take in decimals directly, so had to set it to a double then convert to decimal
            var convertedValue = Convert.ToDecimal(value);
            var ePayment       = new ElectronicPayment(convertedValue);

            // using var to make line shorter

            Assert.AreEqual(convertedValue, ePayment.Value);
            Assert.AreEqual("Electronic Payment", ePayment.Name);
        }
예제 #5
0
        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());
        }
예제 #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());
        }