コード例 #1
0
ファイル: Program.cs プロジェクト: jimxshaw/vslive2017
        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();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: OsvaldoMartini/DI_Projects
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: anilsathe21/Training-1
        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();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: tleviathan/DeepDiveIntoDI
        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();
        }
コード例 #6
0
        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();
        }