Exemplo n.º 1
0
        public void BasketStringParserTest1()
        {
            BasketStringParser bsp = new BasketStringParser();

            bsp.AddProducts("1 book at 12.49");
            bsp.AddProducts("1 music CD at 14.99");
            bsp.AddProducts("1 chocolate bar at 0.85");

            Basket b = bsp.GetBasket();

            Assert.IsNotNull(b);
            Assert.IsTrue(b.Count == 3);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter products below then press '=' to get receipt");

            BasketStringParser bsp = new BasketStringParser();

            while (true)
            {
                string val = Console.ReadLine();
                if (val.Equals("="))
                {
                    break;
                }

                bsp.AddProducts(val);
            }

            Console.WriteLine(bsp.GetBasket().ToString());

            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }