public static void BeCmdLine(IRunSpace space)
 {
     if (space.Args.Length == 0)
     {
         Console.WriteLine("Do you want to create AliveTestConfig File? [y]");
         string answere = Console.ReadLine();
         if (String.Compare(answere, "y", StringComparison.OrdinalIgnoreCase) == 0)
         {
             _mainTrace.TraceEvent(TraceEventType.Information, 1033, "Lets Do a commandLineSession");
             CreateConfigFromConsoleMain(space);
         }
     }
 }
        public static void RunRightModeOfProgram(IRunSpace space, ITestListConfig allTestToDo,out TestController testController)
        {
            testController = null;
            if (space.InIIS)
            {

                allTestToDo.GetTestList();
                testController = new TestController();
                _mainTrace.TraceEvent(TraceEventType.Information, 1031, "Be a CGI program.");
                BeCgi(allTestToDo, testController);
            }
            else
            {
                _mainTrace.TraceEvent(TraceEventType.Information, 1032, "Be a CGI program.");
                BeCmdLine(space);
            }
        }
        private static void CreateConfigFromConsoleMain(IRunSpace space)
        {
             _configTrace.TraceEvent(TraceEventType.Start, 2230, "Enter CreateConfigFromConsoleMain with space {0}.",space.ToString());
            Console.WriteLine("Enter Name of Application pool?");
            string applPool = Console.ReadLine();
            if (!String.IsNullOrEmpty(applPool))
            {
                space.AppPoolId = applPool;
                space.ConfigFile = applPool + ".xml"; 
                var testListConfig = new TestListConfig(space);
                string choice = "0";
                while (choice != "-1")
                {
                    Console.WriteLine("For help enter 0");
                    Console.WriteLine("Create SQL Server DB enter number 1");
                    Console.WriteLine("Create TCP/IP Ping enter number 2");
                    Console.WriteLine("Done/Save config file press Enter");
                    choice = Console.ReadLine();
                    IAliveTest test = null;
                    _configTrace.TraceEvent(TraceEventType.Information, 2231, "Choice of config {0}.", choice);
                    switch (choice)
                    {
                        case "0":
                            Console.WriteLine("No help for you");
                            break;
                        case "1":
                            Console.WriteLine("New DB Test");
                            test = new DatabaseConnTest();
                            break;
                        case "2":
                            Console.WriteLine("New Ping Test");
                            test = new PingTest();
                            break;

                        default:
                            Console.WriteLine("No more tests");
                            choice = "-1";
                            break;
                    }
                    if (test != null)
                    {
                        _configTrace.TraceEvent(TraceEventType.Information, 2231, "CreateConfigFromConsole.");
                        _configTrace.TraceEvent(TraceEventType.Information, 2232, "Create Test of type: {0}",test.GetType().ToString());
                        test.CreateConfigFromConsole();
                        
                        testListConfig.Tests.Add(test);
                        _configTrace.TraceEvent(TraceEventType.Information, 2233, "Added Test: {0}", test.GetType().ToString());
                    }

                }
                testListConfig.SaveToFile();
                Console.WriteLine("Press Enter to Exit");
                choice = Console.ReadLine();
                _configTrace.TraceEvent(TraceEventType.Stop, 2239, "Stop Creating configfile.");

            }
        }
 public TestListConfig(IRunSpace  runSpace)
 {
     ConfigFileName = runSpace.ConfigFile;
     _mainTrace.TraceEvent(TraceEventType.Information, 1021, "ConfigFileName {0} ", ConfigFileName);
     Tests = new TestList();
 }