예제 #1
0
        public List <IMerchandise> Create(IInputReader inputReader)
        {
            // "1 book at 12.49"
            // "1 imported bottle of perfume at 27.99 1"

            var purchase = new List <IMerchandise>();
            var parsers  = inputReader.GetParsers();

            foreach (ILineParser parser in parsers)
            {
                var mecrhType   = MerchandiseTypeByName(parser.GetName());
                var merchandise = new Merchandise(mecrhType, parser.GetFullName(), parser.GetAmount(), parser.GetPrice(), parser.IsImport());
                purchase.Add(merchandise);
            }
            return(purchase);
        }