예제 #1
0
        public ShoppingCart Get()
        {
            var cart = new ShoppingCart();

            var itemrandomizer = new Random();
            var randomizer = new Random();
            var random = randomizer.Next(0,20);

            for (var i = 0; i < random; i++)
            {
                var itemId = itemrandomizer.Next(1, 5);
                cart.Add(_products.FirstOrDefault(x => x.Id == itemId));
            }

            return cart;
        }
 public VolumeDiscountStrategyOld(ShoppingCart cart)
 {
     _cart = cart;
 }
예제 #3
0
 public PricingCalculator(ShoppingCart cart, IDiscountStrategy discountStrategy)
 {
     _cart = cart;
     _discountStrategy = discountStrategy;
 }