本文整理汇总了C#中Program.PrintIfVerbose方法的典型用法代码示例。如果您正苦于以下问题:C# Program.PrintIfVerbose方法的具体用法?C# Program.PrintIfVerbose怎么用?C# Program.PrintIfVerbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program.PrintIfVerbose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EtwPerformanceMetricLogger
public EtwPerformanceMetricLogger(XunitPerformanceProject project, Program program)
{
_etlPath = Path.Combine(project.OutputDir, project.OutputBaseFileName + ".etl");
_program = program;
_project = project;
var diagnosticMessageSink = new ConsoleReporter();
foreach (var assembly in project.Assemblies)
{
program.PrintIfVerbose($"Discovering tests for {assembly.AssemblyFilename}.");
// Note: We do not use shadowCopy because that creates a new AppDomain which can cause
// assembly load failures with delay-signed or "fake signed" assemblies.
using (var controller = new XunitFrontController(
assemblyFileName: assembly.AssemblyFilename,
shadowCopy: false,
appDomainSupport: AppDomainSupport.Denied,
diagnosticMessageSink: new ConsoleDiagnosticsMessageVisitor())
)
using (var discoveryVisitor = new PerformanceTestDiscoveryVisitor(assembly, project.Filters, diagnosticMessageSink))
{
controller.Find(includeSourceInformation: false, messageSink: discoveryVisitor, discoveryOptions: TestFrameworkOptions.ForDiscovery());
discoveryVisitor.Finished.WaitOne();
_tests.AddRange(discoveryVisitor.Tests);
}
}
program.PrintIfVerbose($"Discovered a total of {_tests.Count} tests.");
}
示例2: 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);
}
}
示例3: 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);
}
}