当前位置: 首页>>代码示例>>C#>>正文


C# Program.PrintHeader方法代码示例

本文整理汇总了C#中Program.PrintHeader方法的典型用法代码示例。如果您正苦于以下问题:C# Program.PrintHeader方法的具体用法?C# Program.PrintHeader怎么用?C# Program.PrintHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Program的用法示例。


在下文中一共展示了Program.PrintHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessRecord

        /// <summary>
        /// Assume Invoke-Tests was run previously, aka all dependencies are coppied
        /// </summary>
        protected override void ProcessRecord()
        {
            if(UseLocalUser)
            {
                if (RunComputer == null || RunCredential == null || RunEnvVars == null)
                    throw new Exception("If using local user, must specify runcomputer, runcredential, runenvvars.");
            }

            Program p = new Program();

            if (args.Length == 0 || args[0] == "-?")
            {
                p.PrintHeader();
                Program.PrintUsage();
                return;
            }

            try
            {
                var project = p.ParseCommandLine(args);
                string UserName;

                if (UseLocalUser)
                {
                    UserName = RunCredential.UserName.Substring(RunComputer.Length + 1);
                    project.UseLocalUser = true;
                    project.runComputer = RunComputer;
                    project.runCredentialsUsername = UserName;
                    project.runCredentialsPassword = RunCredential.Password;
                    project.runEnvVars = RunEnvVars;
                }

                if (!p._nologo)
                {
                    p.PrintHeader();
                }

                using (AssemblyHelper.SubscribeResolve())
                {
                    p.PrintIfVerbose($"Creating output directory: {project.OutputDir}");
                    if (!Directory.Exists(project.OutputDir))
                        Directory.CreateDirectory(project.OutputDir);

                    p.RunTests(project);
                    
                }

                WriteObject(Path.Combine(project.OutputDir, project.OutputBaseFileName + ".xml"));
            }
            catch (Exception ex)
            {
                Console.Error.Write("Error: ");
                Program.ReportExceptionToStderr(ex);
            }
        }
开发者ID:visia,项目名称:xunit-performance,代码行数:58,代码来源:InvokePerfTestsCmdlet.cs

示例2: RunFullCmdletTest

        public void RunFullCmdletTest()
        {
            RunComputer = "VISIA1";
            UseLocalUser = true;
            CommandLineArgs = @"D:\VS\out\Tests\SimplePerfTests.dll -outdir D:\VS\out\Tests\TestResults\test -runner D:\PerfUnitTest\xunit\src\xunit.console\bin\Release\xunit.console.exe ";
            int arraySize = 0;
            foreach (System.Collections.DictionaryEntry de in Environment.GetEnvironmentVariables())
            {
                arraySize++;
            }
            RunEnvVars = new System.Collections.DictionaryEntry[arraySize];
            arraySize = 0;
            foreach (System.Collections.DictionaryEntry de in Environment.GetEnvironmentVariables())
            {
                RunEnvVars[arraySize] = de;
                arraySize++;
            }
            var pass = "qwer1234!".ToCharArray();
            System.Security.SecureString securepass = new System.Security.SecureString();
            foreach (char ch in pass)
                securepass.AppendChar(ch);





            if (UseLocalUser)
            {
                if (RunComputer == null || RunEnvVars == null)
                    throw new Exception("If using local user, must specify runcomputer, runcredential, runenvvars.");
            }

            Program p = new Program();

            if (args.Length == 0 || args[0] == "-?")
            {
                p.PrintHeader();
                Program.PrintUsage();
                return;
            }

            try
            {
                var project = p.ParseCommandLine(args);
                string UserName = "Test-D__VS_src-2";

                if (UseLocalUser)
                {
                    project.UseLocalUser = true;
                    project.runComputer = RunComputer;
                    project.runCredentialsUsername = UserName;
                    project.runCredentialsPassword = securepass;
                    project.runEnvVars = RunEnvVars;
                }

                if (!p._nologo)
                {
                    p.PrintHeader();
                }

                using (AssemblyHelper.SubscribeResolve())
                {
                    p.PrintIfVerbose($"Creating output directory: {project.OutputDir}");
                    if (!Directory.Exists(project.OutputDir))
                        Directory.CreateDirectory(project.OutputDir);

                    p.RunTests(project);

                }

                return;
            }
            catch (Exception ex)
            {
                Console.Error.Write("Error: ");
                Program.ReportExceptionToStderr(ex);
            }
        }
开发者ID:visia,项目名称:xunit-performance,代码行数:78,代码来源:CmdletTests.cs


注:本文中的Program.PrintHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。