예제 #1
0
        static void Main()
        {
            ITarget iTarget = new EmployeeAdapter();
            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(iTarget);

            client.ShowEmployeeList();
        }
예제 #2
0
        static void Main(string[] args)
        {
            ITarget Itarget = new EmployeeAdapter();
            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);

            client.ShowEmployeeList();
            Console.ReadKey();
        }
        public void Adapter_WithoutDesign()
        {
            //Our model with incompatible 
            var companyEmplyees = new CompanyEmplyees();

            //Convert it to List<String> ...
            List<string> employeeList = new List<string>();
            foreach (string[] employee in companyEmplyees.GetEmployees())
            {
                employeeList.Add(employee[0]);
                employeeList.Add(",");
                employeeList.Add(employee[1]);
                employeeList.Add(",");
                employeeList.Add(employee[2]);
                employeeList.Add("\n");
            }

            //We use a poor design to pass the data to third party
            ITarget Itarget = new CompanyEmplyeesStub(employeeList);

            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);
            client.ShowEmployeeList();
        }
 public void Adapter_With_Design()
 {
     ITarget Itarget = new EmployeeAdapter();
     ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);
     client.ShowEmployeeList();
 }
예제 #5
0
        static void Main(string[] args)
        {
            ITarget Itarget = new EmployeeAdapter();
            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);
            client.ShowEmployeeList();

            Console.ReadKey();
        }