Esempio n. 1
0
        public Invoice Invoice()
        {
            ILocation domainLocation = new LocationMap(Enum.Parse <LocationName>(Location)).DomainLocation();

            foreach (ProductRequest product in Products)
            {
                _products = _orderStrategy.Add(product, domainLocation);
            }

            return(new Invoice(_products.Select(p => new LineItem(p.Description(), domainLocation.LocalizedPrice(p.Price()))).ToList()));
        }
Esempio n. 2
0
        public List <IProduct> Add(ProductRequest productRequest, ILocation location)
        {
            if (!productRequest.Name.Equals(new PizzaProductName()))
            {
                return(_nextStrategy.Add(productRequest, location));
            }

            IProductSize size = _sizeMap.DomainSize(productRequest.Size);

            _products.Add(new Pizza(size, productRequest.Ingredients.Select(i => _ingredientMap.DomainIngredient(i, new Pizza(size), location)).ToArray()));
            return(_products);
        }