コード例 #1
0
ファイル: Program.cs プロジェクト: exploitx3/HighQualityCode
        static void Main()
        {
            var repository = new CustomerRepository();

            var premiumCustomers = repository.GetPremiumCustomers();
            foreach (var premiumCustomer in premiumCustomers)
            {
                premiumCustomer.RaiseDiscount(5.0);
            }

            var allCustomers = repository.GetAll();
            foreach (var customer in allCustomers)
            {
                customer.AddFreePurchase(new Purchase("SteamOp", 0.0));
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: EBojilova/CSharpHQC
        public static void Main()
        {
            var repository = new CustomerRepository();
            var discountVisitor = new DiscountRaiseVisitor();
            var freePurchaseVisitor = new FreePurchaseVisitor();

            var premiumCustomers = repository.GetPremiumCustomers();
            foreach (var premiumCustomer in premiumCustomers)
            {
                premiumCustomer.Accept(discountVisitor);
            }

            var allCustomers = repository.GetAll();
            foreach (var customer in allCustomers)
            {
                customer.Accept(freePurchaseVisitor);
            }
        }