Ejemplo n.º 1
0
        private static void InterfaceMethod()
        {
            IBookStore bookStoreA = new BookStoreA(CustomerLocation.EastCoast);

            ShipBook(bookStoreA);
            Advertise(bookStoreA);

            IBookStore bookStoreB = new BookStoreB(CustomerLocation.WestCoast);

            ShipBook(bookStoreB);
            Advertise(bookStoreB);

            Console.ReadKey();

            INotification notification = NotificationFactory.GetInstance(NotificationType.Email);

            notification.Send();
            INotification notification1 = NotificationFactory.GetInstance(NotificationType.SMS);

            notification1.Send();

            RechargeAbstract obj2 = new UtilityRecharge(new UtilityRechargeModel());

            obj2.InitiateRequest();

            RechargeAbstract obj3 = new WalletRecharge(new WalletRechargeModel());

            obj3.InitiateRequest();
        }
Ejemplo n.º 2
0
        //LD_ABSTRACT_FACTORY_000
        public static void RunAbstractFactoryDesignPattern()
        {
            //LDAF001
            AbstractFactoryDesignPattern.IBookStore storeA = new AbstractFactoryDesignPattern.BookStoreA(AbstractFactoryDesignPattern.CustomerLocation.EastCoast);
            Console.WriteLine("Book Store A with a customer from East Coast:");
            //LDAF002
            AbstractFactoryDesignPattern.Program.ShipBook(storeA);
            AbstractFactoryDesignPattern.Program.Advertise(storeA);

            //LD identical situation for advertisement
            AbstractFactoryDesignPattern.IBookStore storeB = new BookStoreB(AbstractFactoryDesignPattern.CustomerLocation.WestCoast);
            Console.WriteLine("Book Store B with a customer from West Coast:");
            AbstractFactoryDesignPattern.Program.ShipBook(storeB);
            AbstractFactoryDesignPattern.Program.Advertise(storeB);
        }