本文整理汇总了C#中TestRunner.ConsoleWriteRed方法的典型用法代码示例。如果您正苦于以下问题:C# TestRunner.ConsoleWriteRed方法的具体用法?C# TestRunner.ConsoleWriteRed怎么用?C# TestRunner.ConsoleWriteRed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestRunner
的用法示例。
在下文中一共展示了TestRunner.ConsoleWriteRed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string[] args)
{
Console.WindowWidth = 120;
var noPause = args.Contains("/nopause");
var runner = new TestRunner(errorFile: "_errors.log");
var configs = BuildServerConfigs();
int skipServerCount = 0;
var testRuns = runner.RunTests(typeof(Program).Assembly, configs,
// init action for server type; must return true to run the tests
cfg => {
Console.WriteLine();
Console.WriteLine(cfg.ToString());
SetupHelper.Reset(cfg);
// Check if server is available
string error;
if (ToolHelper.TestConnection(SetupHelper.Driver, SetupHelper.ConnectionString, out error)) return true;
runner.ConsoleWriteRed(" Connection test failed for connection string: {0}, \r\n Error: {1}", SetupHelper.ConnectionString, error);
skipServerCount++;
return false;
});
//Report results
var errCount = testRuns.Sum(tr => tr.Errors.Count) + skipServerCount;
Console.WriteLine();
if (errCount > 0)
runner.ConsoleWriteRed("Errors: " + errCount);
// stop unless there's /nopause switch
if (!noPause) {
Console.WriteLine("Press any key...");
Console.ReadKey();
}
return errCount == 0 ? 0 : -1;
}