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;
        }
예제 #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);
        }
예제 #3
0
 public Product ApplyDiscountFor(IPrincipal user)
 {
     var dicountPolicy = new DefaultCustomerDiscountPolicy();
     return dicountPolicy.Apply(this, user);
 }
예제 #4
0
        public Product ApplyDiscountFor(IPrincipal user)
        {
            var dicountPolicy = new DefaultCustomerDiscountPolicy();

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