private InputResponse ParseInput(string input)
        {
            InputResponse response = new InputResponse
            {
                Success  = false,
                Message  = "Not Started",
                Quantity = 1,
                Price    = 0.00M,
                Name     = ""
            };

            string[] splitInput = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            // Parse Quantity
            try
            {
                response.Quantity = int.Parse(splitInput[0]);

                if (response.Quantity <= 0)
                {
                    throw new Exception("Invalid quantity.");
                }
            }
            catch (Exception)
            {
                response.Message = "Please enter a valid quantity.";
                return(response);
            }

            for (int i = 1; i < splitInput.Length; i++)
            {
                if (splitInput[i] == "at")
                {
                    try
                    {
                        //Parse Price
                        response.Price = decimal.Parse(splitInput[i + 1]);

                        if (response.Price <= 0)
                        {
                            throw new Exception("Invalid Price.");
                        }
                        i = splitInput.Length; // stop parsing
                    }
                    catch (Exception)
                    {
                        response.Message = "Please enter a valid Price.";
                        return(response);
                    }
                }
                else
                {
                    //Parse Name
                    response.Name += " " + splitInput[i];
                }
            }
            response.Success = true;
            response.Message = AddtoBasket(response.Quantity, response.Name, response.Price);
            return(response);
        }
        public bool Working()
        {
            string input = Console.ReadLine();

            if (string.IsNullOrEmpty(input))//Generate Receipt
            {
                if (Basket.Count < 1)
                {
                    Console.WriteLine("Please enter a quantity, item name, and price.");
                    return(true);
                }

                Console.WriteLine(GenerateReceipt());
                return(ResetOrExit());
            }
            else if (input.Trim().ToLower() == "unit test")
            {
                UnitTest();
                return(ResetOrExit());
            }
            else // attempt to parse input and add to basket.
            {
                InputResponse response = ParseInput(input.Trim());
                Console.WriteLine(response.Message);
                return(true);
            }
        }
        // Used to run unit test from txt file
        public void UnitTest()
        {
            Console.WriteLine("");
            Console.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Beginning Unit Test !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            Console.WriteLine("");
            try
            {
                string workingDirectory = Environment.CurrentDirectory;
                string projectDirectory = Directory.GetParent(workingDirectory).Parent.FullName;

                string[] lines = File.ReadAllLines(projectDirectory + @"\UnitTest.txt");

                foreach (var line in lines)
                {
                    if (string.IsNullOrEmpty(line))
                    {
                        Console.WriteLine("TEST LINE : (Enter - Generate Receipt)");
                        Console.WriteLine(GenerateReceipt());
                        ClearBasket();
                        Console.WriteLine();
                    }
                    else
                    {
                        Console.WriteLine("TEST LINE : " + line);
                        InputResponse response = ParseInput(line.Trim());
                        Console.WriteLine(response.Message);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Unit Test encountered an error : " + e);
                Console.WriteLine("");
                Console.WriteLine("Make sure the file UnitTest.txt exists in the project directory.");
            }
            Console.WriteLine("");
            Console.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! End Unit Test !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            Console.WriteLine("");
        }