本文整理汇总了C#中AutoTest.Core.Messaging.MessageConsumers.TestRunInfo.Where方法的典型用法代码示例。如果您正苦于以下问题:C# TestRunInfo.Where方法的具体用法?C# TestRunInfo.Where怎么用?C# TestRunInfo.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoTest.Core.Messaging.MessageConsumers.TestRunInfo
的用法示例。
在下文中一共展示了TestRunInfo.Where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveUnmatchedRunInfoTests
public List<TestRunResults> RemoveUnmatchedRunInfoTests(TestRunResults[] results, TestRunInfo[] infos)
{
var tests = new List<TestItem>();
tests.AddRange(_cache.Failed);
tests.AddRange(_cache.Ignored);
var removed = new List<TestRunResults>();
infos
.Where(i => results.Count(x => i.Assembly.Equals(x.Assembly)) == 0).ToList()
.ForEach(i =>
{
tests.Where(x => x.Key.Equals(i.Assembly) &&
(!i.OnlyRunSpcifiedTestsFor(x.Value.Runner) || i.GetTestsFor(x.Value.Runner).Count(t => t.Equals(x.Value.Name)) > 0))
.GroupBy(x => x.Value.Runner).ToList()
.ForEach(x =>
{
removed.Add(new TestRunResults(
i.Project.Key,
i.Assembly,
i.OnlyRunSpcifiedTestsFor(TestRunner.Any),
x.Key,
x.Select(t => new TestResult(
t.Value.Runner,
TestRunStatus.Passed,
t.Value.Name,
t.Value.Message,
t.Value.StackTrace,
t.Value.TimeSpent.TotalMilliseconds).SetDisplayName(t.Value.DisplayName)).ToArray()));
});
});
return removed;
}
示例2: getResults
private TestRunResults[] getResults(IEnumerable<AutoTest.TestRunners.Shared.Results.TestResult> tests, TestRunInfo[] runInfos)
{
var results = new List<TestRunResults>();
foreach (var byRunner in tests.GroupBy(x => x.Runner))
{
var runner = TestRunnerConverter.FromString(byRunner.Key);
foreach (var byAssembly in byRunner.GroupBy(x => x.Assembly))
{
var info = runInfos.Where(x => x.Assembly.Equals(byAssembly.Key)).FirstOrDefault();
var project = "";
var partial = false;
if (info != null)
{
if (info.Project != null)
project = info.Project.Key;
partial = info.OnlyRunSpcifiedTestsFor(runner) ||
info.GetTestsFor(runner).Count() > 0 ||
info.GetMembersFor(runner).Count() > 0 ||
info.GetNamespacesFor(runner).Count() > 0;
}
DebugLog.Debug.WriteDetail(string.Format("Partial run is {0} for runner {1}", partial, runner));
var result = new TestRunResults(
project,
byAssembly.Key,
partial,
runner,
byAssembly.Select(x => new Messages.TestResult(
runner,
getTestState(x.State),
x.TestName,
x.Message,
x.StackLines.Select(y => (IStackLine)new StackLineMessage(y.Method, y.File, y.Line)).ToArray<IStackLine>()
)).ToArray()
);
result.SetTimeSpent(TimeSpan.FromMilliseconds(byAssembly.Sum(x => x.DurationInMilliseconds)));
results.Add(result);
}
}
return results.ToArray();
}
示例3: getTests
private RunnerOptions getTests(Plugin plugin, TestRunInfo[] runInfos)
{
var instance = plugin.New();
if (instance == null)
return null;
var infos = runInfos.Where(x => instance.ContainsTestsFor(x.Assembly));
if (infos.Count() == 0)
return null;
return getRunnerOptions(infos, instance);
}