本文整理汇总了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);
}
}
示例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);
}
}