Exemplo n.º 1
0
        private static void TestExamples()
        {
            var cart = new Cart();

            cart.AddItem("Cart 1");
            cart.AddItem("FR1");
            cart.AddItem("SR1");
            cart.AddItem("FR1");
            cart.AddItem("FR1");
            cart.AddItem("CF1");
            Console.WriteLine("Expected : \u00A322.45");
            Console.WriteLine(cart.ToString());


            cart = new Cart();
            cart.AddItem("Cart 2");
            cart.AddItem("FR1");
            cart.AddItem("FR1");
            Console.WriteLine("Expected : \u00A33.11");
            Console.WriteLine(cart.ToString());

            cart = new Cart();
            cart.AddItem("Cart 3");
            cart.AddItem("SR1");
            cart.AddItem("SR1");
            cart.AddItem("FR1");
            cart.AddItem("SR1");
            Console.WriteLine("Expected : \u00A316.61");
            Console.WriteLine(cart.ToString());
        }
Exemplo n.º 2
0
        private static void TestExamples()
        {
            var cart = new Cart();
            cart.AddItem("Cart 1");
            cart.AddItem("FR1");
            cart.AddItem("SR1");
            cart.AddItem("FR1");
            cart.AddItem("FR1");
            cart.AddItem("CF1");
            Console.WriteLine("Expected : \u00A322.45");
            Console.WriteLine(cart.ToString());

            cart = new Cart();
            cart.AddItem("Cart 2");
            cart.AddItem("FR1");
            cart.AddItem("FR1");
            Console.WriteLine("Expected : \u00A33.11");
            Console.WriteLine(cart.ToString());

            cart = new Cart();
            cart.AddItem("Cart 3");
            cart.AddItem("SR1");
            cart.AddItem("SR1");
            cart.AddItem("FR1");
            cart.AddItem("SR1");
            Console.WriteLine("Expected : \u00A316.61");
            Console.WriteLine(cart.ToString());
        }
Exemplo n.º 3
0
 private static void TestInputString(string input)
 {
     var cart = new Cart();
     var inputList = input.Split(',');
     foreach (var inputItem in inputList.Where(inputItem => cart.AddItem(inputItem) != 0))
     {
         Console.WriteLine("There was an error trying to find the product :" + inputItem);
     }
     Console.Write(cart.ToString());
 }
Exemplo n.º 4
0
        private static void TestInputString(string input)
        {
            var cart      = new Cart();
            var inputList = input.Split(',');

            foreach (var inputItem in inputList.Where(inputItem => cart.AddItem(inputItem) != 0))
            {
                Console.WriteLine("There was an error trying to find the product :" + inputItem);
            }
            Console.Write(cart.ToString());
        }