Ejemplo n.º 1
0
 public void Init()
 {
     ruleMapper = new PriceRulesMapper();
 }
Ejemplo n.º 2
0
 public void Cleanup()
 {
     ruleMapper = null;
 }
Ejemplo n.º 3
0
 public void Cleanup()
 {
     cartMapper = null;
     ruleMapper = null;
 }
Ejemplo n.º 4
0
 public void Init()
 {
     cartMapper = new ShoppingListMapper();
     ruleMapper = new PriceRulesMapper();
 }
Ejemplo n.º 5
0
        public void CheckOut()
        {
            var slm = new ShoppingListMapper();
            var prm = new PriceRulesMapper();

            //process the price rules list
            var rules = prm.ReadRules(_priceRulesFile);

            //process the shopping cart
            var items = slm.ReadShoppingList(_cartFile);

            //check to make sure everything purchased has a price
            foreach ( var key in items.Keys)
            {
                if (rules.ContainsKey(key)) continue;

                var rule = prm.GetRuleForMissingItem(key);
                rules[key] = rule;
            }

            this.ProcessReceipt(items, rules, _compoundSavings);
        }