Esempio n. 1
0
        public static void Main()
        {
            // Refactoring library

            IRechargeable   robot           = new Robot("id", 23);
            Employee        employee        = new Employee("pesho");
            RechargeStation rechargeStation = new RechargeStation();

            //rechargeStation.Recharge(employee);
            rechargeStation.Recharge(robot);
        }
        public static void Main()
        {
            // using Adapter pattern

            IRechargeable   robot           = new RobotAdapter("id", 23);
            ISleeper        employee        = new EmployeeAdapter("pesho");
            RechargeStation rechargeStation = new RechargeStation();

            //rechargeStation.Recharge(employee);
            rechargeStation.Recharge(robot);
        }
Esempio n. 3
0
        public static void Main()
        {
            var robot = new Robot("Refactored Robot", 100);

            robot.Work(24);
            robot.Recharge();

            var employee = new Employee("Refactored employee");

            employee.Work(8);
            employee.Sleep();

            var rechargeStation = new RechargeStation();

            rechargeStation.Recharge(robot);
        }