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;
        }
Exemplo n.º 2
0
 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();
 }
 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);
 }