Exemplo n.º 1
0
        /// <inheritdoc/>
        public object Clone()
        {
            var cart = new StandardCart(this.priceList);

            foreach (var item in this.items)
            {
                cart.Add(item.Clone() as SkuCartEntry);
            }

            return(cart);
        }
Exemplo n.º 2
0
        private static ICart Merge(ICart cart1, ICart cart2, IDictionary <Sku, decimal> priceList)
        {
            ICart mergeCart = new StandardCart(priceList);
            Action <ICart, ICart> merger = (ICart src, ICart dst) =>
            {
                foreach (var entry in src)
                {
                    dst.Add(entry);
                }
            };

            merger(cart1, mergeCart);
            merger(cart2, mergeCart);

            return(mergeCart);
        }