Ejemplo n.º 1
0
        private void TryRun()
        {
            _isRunning = true;
            var       testReportCollection = new TestReportCollection();
            Stopwatch multiRunStopwatch    = Stopwatch.StartNew();

            while (_queuedRuns.Count > 0)
            {
                XapFileBuildChangedServerEvent buildEvent;

                lock (_sync)
                {
                    buildEvent = _queuedRuns.Dequeue();
                }

                var xapPath = buildEvent.XapPath;

                _currentStatLightConfiguration.SetCurrentTo(xapPath);

                _currentStatLightConfiguration.Current.Client.TagFilter = _currentFilterString;

                using (var onetimeRunner = new OnetimeRunner(
                           logger: _logger,
                           eventSubscriptionManager: _eventSubscriptionManager,
                           eventPublisher: _eventPublisher,
                           webServer: _webServer,
                           webBrowsers: _webBrowsers,
                           xapPath: xapPath,
                           dialogMonitorRunner: _dialogMonitorRunner))
                {
                    Stopwatch  singleRunStopwatch = Stopwatch.StartNew();
                    TestReport testReport         = onetimeRunner.Run();
                    singleRunStopwatch.Stop();
                    testReportCollection.Add(testReport);
                    _eventPublisher.SendMessage(new TestReportGeneratedServerEvent(testReport, singleRunStopwatch.Elapsed, shouldPrintSummary: _statLightConfigurations.Count > 1));
                }
            }

            multiRunStopwatch.Stop();
            _isRunning = false;

            if (testReportCollection.Any())
            {
                _eventPublisher.SendMessage(new TestReportCollectionGeneratedServerEvent(testReportCollection, multiRunStopwatch.Elapsed));
            }
        }