public override Basket Apply(Basket basket)
        {
            var policy = new DefaultCustomerDiscountPolicy();

            var evaluatedBasket = new Basket(basket.Owner);
            foreach (var extent in basket.Contents)
            {
                var evaluatedProduct = policy.Apply(extent.Product, basket.Owner);
                evaluatedBasket.Contents.Add(extent.WithItem(evaluatedProduct));
            }

            return evaluatedBasket;
        }
Exemplo n.º 2
0
        public override Basket Apply(Basket basket)
        {
            var policy = new DefaultCustomerDiscountPolicy();

            var evaluatedBasket = new Basket(basket.Owner);

            foreach (var extent in basket.Contents)
            {
                var evaluatedProduct = policy.Apply(extent.Product, basket.Owner);
                evaluatedBasket.Contents.Add(extent.WithItem(evaluatedProduct));
            }

            return(evaluatedBasket);
        }
Exemplo n.º 3
0
 public Product ApplyDiscountFor(IPrincipal user)
 {
     var dicountPolicy = new DefaultCustomerDiscountPolicy();
     return dicountPolicy.Apply(this, user);
 }
Exemplo n.º 4
0
        public Product ApplyDiscountFor(IPrincipal user)
        {
            var dicountPolicy = new DefaultCustomerDiscountPolicy();

            return(dicountPolicy.Apply(this, user));
        }