本文整理汇总了C#中IEngine.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# IEngine.Skip方法的具体用法?C# IEngine.Skip怎么用?C# IEngine.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEngine
的用法示例。
在下文中一共展示了IEngine.Skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTestSuite
private static void RunTestSuite(Type testSuiteType)
{
string basePath = Path.Combine(
Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(typeof(Program).Assembly.Location))),
"Suites"
);
var resultSets = new List<Dictionary<string, ITestResult>>();
var engines = new IEngine[] { new Engines.JintEngine(), new IronJsEngine(), new JurassicEngine() };
foreach (var engine in engines)
{
var testSuite = (TestSuite)Activator.CreateInstance(testSuiteType, new object[] { basePath, engine });
resultSets.Add(testSuite.Run());
}
// Create the relative test results.
var lines = new List<ResultLine>();
foreach (string test in resultSets[0].Keys)
{
lines.Add(new ResultLine(
Path.GetFileName(test),
resultSets.Select(p => p[test]).ToList()
));
}
lines.Sort((a, b) => a.RelativeResults[0].Difference.CompareTo(b.RelativeResults[0].Difference));
// Calculate the column widths.
const string testHeader = "Test";
var columns = new int[engines.Length];
columns[0] = testHeader.Length;
for (int i = 1; i < engines.Length; i++)
{
columns[i] = engines[i].Name.Length;
}
foreach (var line in lines)
{
columns[0] = Math.Max(columns[0], line.Test.Length);
for (int i = 0; i < line.RelativeResults.Count; i++)
{
columns[i + 1] = Math.Max(columns[i + 1], line.RelativeResults[i].ToString().Length);
}
}
// Print the header.
ConsoleEx.Write(ConsoleColor.DarkCyan, "Test results relative to ");
ConsoleEx.WriteLine(ConsoleColor.Cyan, engines[0].Name);
ConsoleEx.WriteLine(ConsoleColor.DarkCyan, "=================================================");
Console.WriteLine();
WriteGridLine(
columns,
new[] { ConsoleColor.Cyan },
new[] { testHeader }.Concat(engines.Skip(1).Select(p => p.Name))
);
WriteGridSeparator(columns);
foreach (var line in lines)
{
var colors = new List<ConsoleColor>();
colors.Add(ConsoleColor.Gray);
for (int i = 0; i < line.RelativeResults.Count; i++)
{
colors.Add(line.RelativeResults[i].Difference < 1 ? ConsoleColor.Green : ConsoleColor.Red);
}
WriteGridLine(
columns,
colors.ToArray(),
new[] { line.Test }.Concat(line.RelativeResults.Select(p => p.ToString()))
);
}
Console.WriteLine();
}