private RunnerOptions getRunnerOptions(IEnumerable <TestRunInfo> unitInfos, IAutoTestNetTestRunner instance)
        {
            DebugLog.Debug.WriteDetail("Getting runner options for {0}", instance.Identifier);
            var runner     = new RunnerOptions(instance.Identifier);
            var testRunner = TestRunnerConverter.FromString(instance.Identifier);

            foreach (var info in unitInfos)
            {
                DebugLog.Debug.WriteDetail("Handling {0}", info.Assembly);
                DebugLog.Debug.WriteDetail("About to add assembly");
                var assembly = new AssemblyOptions(info.Assembly);
                assembly.AddTests(info.GetTestsFor(testRunner));
                assembly.AddTests(info.GetTestsFor(TestRunner.Any));
                DebugLog.Debug.WriteDetail("Found {0} tests for assembly", assembly.Tests.Count());
                assembly.AddMembers(info.GetMembersFor(testRunner));
                assembly.AddMembers(info.GetMembersFor(TestRunner.Any));
                DebugLog.Debug.WriteDetail("Found {0} members for assembly", assembly.Members.Count());
                assembly.AddNamespaces(info.GetNamespacesFor(testRunner));
                assembly.AddNamespaces(info.GetNamespacesFor(TestRunner.Any));
                DebugLog.Debug.WriteDetail("Found {0} namespaces for assembly", assembly.Namespaces.Count());
                DebugLog.Debug.WriteDetail("Run only specified tests for runner {0} is {1}", testRunner, info.OnlyRunSpcifiedTestsFor(testRunner));
                if (info.OnlyRunSpcifiedTestsFor(testRunner) && assembly.Tests.Count() == 0 && assembly.Members.Count() == 0 && assembly.Namespaces.Count() == 0)
                {
                    continue;
                }
                DebugLog.Debug.WriteDetail("Adding assembly");
                runner.AddAssembly(assembly);
            }
            return(runner);
        }
 public static Messages.TestResult ConvertResult(AutoTest.TestRunners.Shared.Results.TestResult x)
 {
     return(new Messages.TestResult(TestRunnerConverter.FromString(x.Runner),
                                    getTestState(x.State),
                                    x.TestName,
                                    x.Message,
                                    x.StackLines.Select(y => (IStackLine) new StackLineMessage(y.Method, y.File, y.Line)).ToArray <IStackLine>(),
                                    x.DurationInMilliseconds
                                    ));
 }
        private OnDemandRunInternal add(OnDemandRun run, IAutoTestNetTestRunner runner, IEnumerable <string> tests, IEnumerable <string> members, IEnumerable <string> namespaces)
        {
            if (alreadySetToTestAll(run))
            {
                return(null);
            }
            var existing = _list.Where(x => x.Project.Equals(run.Project) && x.Runner.Equals(TestRunnerConverter.FromString(runner.Identifier))).FirstOrDefault();

            if (existing != null)
            {
                Logger.WriteDebug("Joining with existing run " + existing.Project + " with runner " + runner.Identifier);
                existing.JoinWith(tests, members, namespaces);
                return(existing);
            }
            Logger.WriteDebug("Adding new run " + run.Project + " with runner " + runner.Identifier);
            var internalRun = new OnDemandRunInternal(TestRunnerConverter.FromString(runner.Identifier), run.Project, tests.ToArray(), members.ToArray(), namespaces.ToArray());

            _list.Add(internalRun);
            return(_list[_list.Count - 1]);
        }
        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 => ConvertResult(x)).ToArray());
                    result.SetTimeSpent(TimeSpan.FromMilliseconds(byAssembly.Sum(x => x.DurationInMilliseconds)));
                    results.Add(result);
                }
            }
            return(results.ToArray());
        }
 private void addEmtpyRun(OnDemandRun run, IAutoTestNetTestRunner runner)
 {
     _list.Add(new OnDemandRunInternal(TestRunnerConverter.FromString(runner.Identifier), run.Project, new string[] {}, new string[] {}, new string[] {}));
 }