Esempio n. 1
0
        public void Main()
        {
            Console.WriteLine("Object Adapter\n");

            OrderSystem orderSystem = new OrderSystem();

            orderSystem.AddOrder("Leo", 150, "USD");
            orderSystem.AddOrder("Wayne", 400, "HKD");
            orderSystem.AddOrder("Mary", 3000, "JPY");

            DepositSystem depositSystem = new DepositSystem();

            depositSystem.AddDeposit("Jimmy", 100, "USD");
            depositSystem.AddDeposit("Tom", 500, "HKD");
            depositSystem.AddDeposit("Jason", 1500, "JPY");

            CurrencyAdapter targetAdapter = new CurrencyAdapter(orderSystem, depositSystem);

            ThirdPartyBillingSystem billingSystem = new ThirdPartyBillingSystem(targetAdapter);

            billingSystem.ProcessOrderList();
            billingSystem.ProcessDepositList();
        }
Esempio n. 2
0
 public CurrencyAdapter(OrderSystem orderSystem, DepositSystem depositSystem)
 {
     _orderSystem   = orderSystem;
     _depositSystem = depositSystem;
 }