public void DollarTests() { ICurrency dollar = new Dollar(); Assert.AreEqual(1m, dollar.Value); Assert.AreEqual("Dollar", dollar.Name); }
public void InjectingIntoConstructors() { var dollar = new Dollar(); var ePayment = new ElectronicPayment(317.2m); 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()); }
public void InjectingIntoConstructors() { // Creating new instances of our ICurrency interface objects var dollar = new Dollar(); var ePay = new ElectronicPayment(243.71m); // "Injecting" them into Transaction class for that _currency field var firstTransaction = new Transaction(dollar); var secondTransaction = new Transaction(ePay); Console.WriteLine(firstTransaction.GetTransactionType()); Console.WriteLine(secondTransaction.GetTransactionType()); Console.WriteLine(secondTransaction.GetTransactionAmount()); }