コード例 #1
0
 private static void Main(string[] args)
 {
     // Trace start
     Trace.CorrelationManager.ActivityId = Guid.NewGuid();
     Trace.CorrelationManager.StartLogicalOperation("Main");
     _mainTrace.TraceEvent(TraceEventType.Start, 1000, "Program start.");
     _mainTrace.TraceEvent(TraceEventType.Information, 1010, "Get RunSpaceinfo.");
     var space = new RunSpace {Args = args};
     _mainTrace.TraceEvent(TraceEventType.Information, 1020, "Get TestListConfig.");
     var allTestToDo = new TestListConfig(space);
    TestController testController;
    _mainTrace.TraceEvent(TraceEventType.Information, 1030, "Decide Program mode.");
    RunRightModeOfProgram(space, allTestToDo, out testController);
    _mainTrace.TraceEvent(TraceEventType.Stop, 1090, "Program Stop.");
    Trace.CorrelationManager.StopLogicalOperation();
 }
コード例 #2
0
        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.");

            }
        }