static void Main(string[] args) { Console.WriteLine("ABSTRACTION Example"); Console.WriteLine(); OrderInfo orderInfo = new OrderInfo() { CustomerName = "Miguel Castro", Email = "*****@*****.**", Product = "Laptop", Price = 1200, CreditCard = "1234567890" }; Console.WriteLine("Production:"); Console.WriteLine(); Commerce commerce = new Commerce(new BillingProcessor(), new Customer(), new Notifier(), new Logger()); commerce.ProcessOrder(orderInfo); Console.WriteLine(); Console.WriteLine("Press [Enter] to exit..."); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Abstraction Example"); Console.WriteLine(""); OrderInfo orderInfo = new OrderInfo() { CustomerName = "Claudia Almeida", Email = "*****@*****.**", Product = "LCD Monitor Smart Samsung", Price = 259.00f, CreditCard = "1234.5678.9876.5432" }; Console.WriteLine("Production"); Console.WriteLine(""); //A Little coupled here (Newing Up classes), But we can consider this as Kick Start Commerce commerce = new Commerce(new BillingProcessor(), new Customer(), new Notifier(), new Logger()); commerce.ProcessOrder(orderInfo); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit..."); Console.ReadLine(); }
static void Main(string[] args) { var orderInfo = new OrderInfo { CustomerName = "Rachid Lamtabbet", CreditCard = "12457845125464721", Price = 119.99, Product = "Kindel WhitePaper 2" }; Console.WriteLine("Production:"); Console.WriteLine(); var commerce = new Commerce(new BillingProcessor(), new Customer(), new Notifier(), new Logger()); commerce.ProcessOrder(orderInfo); Console.WriteLine(); Console.WriteLine("Test:"); Console.WriteLine(); var commerceTest = new Commerce(new TestBillingProcessor(), new TestCustomer(), new TestNotifier(), new TestLogger()); commerceTest.ProcessOrder(orderInfo); Console.Read(); }
static void Main(string[] args) { var orderInfo = new OrderInfo { CustomerName = "Prasad Honrao", Email = "*****@*****.**", Product = "iPad", Price = 499, CreditCard = 123456 }; // Production var commerce = new Commerce(new BillingProcessor(), new CustomerProcessor(), new Notifier(), new Logger()); commerce.ProcessOrder(orderInfo); Console.WriteLine("Order processed successfully"); Console.WriteLine("-----------------------------"); // Test var testCommerce = new Commerce(new TestBillingProcessor(), new TestCustomerProcessor(), new TestNotifier(), new TestLogger()); testCommerce.ProcessOrder(orderInfo); Console.WriteLine("Test Order processed successfully"); Console.ReadLine(); }
private static void ShowcaseConstructorInjection() { #region Constructor Injection Commerce commerce = new Commerce(new BillingProcessor(), new Customer(), new Notifier(), new Logger()); commerce.ProcessOrder(_orderInfo); #endregion Console.WriteLine(); Console.WriteLine("==========================================================="); Console.WriteLine(); }