Esempio n. 1
0
        protected static void AddMenu(Assembly assemblyToAnalyze, string name, char option, ConsoleMenuDelegate menuDelegate, string header)
        {
            if (Menus == null)
            {
                Menus = new List <ConsoleMenu>();
            }

            ConsoleMenu menu = new ConsoleMenu();

            menu.HeaderText        = header;
            menu.MenuKey           = option;
            menu.Menu              = menuDelegate;
            menu.Name              = name;
            menu.AssemblyToAnalyze = assemblyToAnalyze;
            AddMenu(menu);
        }
        public static void TestMenu(Assembly assemblyToAnalyze, ConsoleMenu[] otherMenus, string header)
        {
            Console.WriteLine(header);
            List<ConsoleInvokeableMethod> tests = GetTests(assemblyToAnalyze);
            ShowMenu(tests);
            Console.WriteLine();
            Console.WriteLine("Q to quit\ttype all to run all tests.");
            string answer = ShowSelectedMenuOrReturnAnswer(otherMenus);

            try
            {
                if (answer.Trim().ToLower().Equals("all"))
                {
                    bool enterManually = true;
                    if (interactive)
                        enterManually = Confirm("Would you like to enter parameters manually? [y][N]");
                    if (enterManually)
                        RunAllTestsInteractively(assemblyToAnalyze);
                    else
                        RunAllTests(assemblyToAnalyze);
                }
                else
                {

                    RunTest(tests, answer);
                }
            }
            catch (Exception ex)
            {
                Error("An error occurred running tests", ex);
            }

            if (Confirm("Return to the Test menu? [y][N]"))
                TestMenu(assemblyToAnalyze, otherMenus, header);
            else
                Exit(0);
        }
Esempio n. 3
0
 protected static void AddMenu(ConsoleMenu menu)
 {
     Menus.Add(menu);
 }