Exemplo n.º 1
0
        /**
         * <remarks>
         *      This method supports chaining
         * </remarks>
         *
         * <exception cref="ProductNotFoundException">
         *      Thrown when productCode does not exist in data source
         * </exception>
         */
        public PointOfSaleTerminal ScanProduct(string productCode)
        {
            var product = dataSource.FindProduct(productCode: productCode);

            if (product == null)
            {
                throw new ProductNotFoundException($"Product {productCode} does not exist");
            }

            cart.Add(product);
            return(this);
        }