예제 #1
0
        public KarmaTestContainerDiscoverer(
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
            ILogger logger,
            ISolutionListener solutionListener,
            ITestFilesUpdateWatcher testFilesUpdateWatcher,
            ITestFileAddRemoveListener testFilesAddRemoveListener)
        {
            Logger = KarmaLogger.Create(logger: logger);

            _serviceProvider  = serviceProvider;
            _solutionListener = solutionListener;

            _testFilesUpdateWatcher          = testFilesUpdateWatcher;
            _testFilesUpdateWatcher.Changed += OnProjectItemChanged;

            _testFilesAddRemoveListener          = testFilesAddRemoveListener;
            _testFilesAddRemoveListener.Changed += OnProjectItemChanged;
            _testFilesAddRemoveListener.StartListening();

            _solutionListener.SolutionUnloaded += SolutionListenerOnSolutionUnloaded;
            _solutionListener.ProjectChanged   += OnSolutionProjectChanged;
            _solutionListener.StartListening();

            Logger.Info("KarmaTestContainerDiscoverer created");
        }
예제 #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_testFilesUpdateWatcher != null)
                {
                    _testFilesUpdateWatcher.Changed -= OnProjectItemChanged;
                    _testFilesUpdateWatcher.Dispose();
                    _testFilesUpdateWatcher = null;
                }

                if (_testFilesAddRemoveListener != null)
                {
                    _testFilesAddRemoveListener.Changed -= OnProjectItemChanged;
                    _testFilesAddRemoveListener.StopListening();
                    _testFilesAddRemoveListener.Dispose();
                    _testFilesAddRemoveListener = null;
                }

                if (_solutionListener != null)
                {
                    _solutionListener.ProjectChanged -= OnSolutionProjectChanged;
                    _solutionListener.StopListening();
                    _solutionListener.Dispose();
                    _solutionListener = null;
                }
            }
        }