Esempio n. 1
0
        public void Sample3TestMethod()
        {
            Writer.SetWriter<DebugOutput>();

            const string request = "morning, 1, 2, 3, 4";
            var req = request.Replace(" ", "")
                            .Split(',');

            string output;
            using (var order = new OrderUp())
            {
                var response = order.GetOrder(req);
                output = Parser.ParseOrders(response);

                Writer.WriteOutput(output);
            }

            Assert.AreEqual("Output: eggs, toast, coffee, error", output);
        }
Esempio n. 2
0
        public static void Main()
        {
            // Set output Writer
            Writer.SetWriter<ConsoleOutput>();
            //Writer.SetWriter<ConsoleOutputChristmas>();

            // Prompt for input
            Console.Write("Input: ");
            var input = Console.ReadLine();

            // Remove spaces and split on commas
            var req = input?.Replace(" ", "")
                            .Split(',');

            // Check if the user entered a usuable order, exit if not
            if (req == null || req.Length < 2)
            {
                Writer.WriteOutput("Output: error(\"At least one selection is required!\") ");
            }
            else
                using (var order = new OrderUp())
                {
                    // Store order in buckets
                    var response = order.GetOrder(req);

                    // Parse order to a string
                    var res = Parser.ParseOrders(response);

                    // Print order
                    Writer.WriteOutput(res);
                }

            // Wait for user to press a key and exit
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
Esempio n. 3
0
        public void Sample7TestMethod()
        {
            Writer.SetWriter<DebugOutput>();

            const string request = "night, 1, 2, 3, 5";
            var req = request.Replace(" ", "")
                            .Split(',');

            string output;
            using (var order = new OrderUp())
            {
                var response = order.GetOrder(req);
                output = Parser.ParseOrders(response);

                Writer.WriteOutput(output);
            }

            Assert.AreEqual("Output: steak, potato, wine, error", output);
        }