Beispiel #1
0
        // Handler to react to project load/unload events.
        private void OnSolutionProjectChanged(object sender, SolutionEventsListenerEventArgs e)
        {
            if (e != null)
            {
                string projectPath = VsSolutionHelper.GetProjectPath(e.Project);

                var files = this.FindPotentialTestFiles(e.Project);
                if (e.ChangedReason == SolutionChangedReason.Load)
                {
                    this.UpdateTestContainersAndFileWatchers(files, true);
                }
                else if (e.ChangedReason == SolutionChangedReason.Unload)
                {
                    this.UpdateTestContainersAndFileWatchers(files, false);
                }
            }

            // Do not fire OnTestContainersChanged here.
            // This will cause us to fire this event too early before the UTE is ready to process containers and will result in an exception.
            // The UTE will query all the TestContainerDiscoverers once the solution is loaded.
        }
        // Handler to react to project load/unload events.
        private void OnSolutionProjectChanged(object sender, SolutionEventsListenerEventArgs e)
        {
            if (e != null)
            {
                string projectPath = VsSolutionHelper.GetProjectPath(e.Project);

                var files = this.FindPotentialTestFiles(e.Project);
                if (e.ChangedReason == SolutionChangedReason.Load)
                {
                    this.UpdateTestContainersAndFileWatchers(files, true);
                }
                else if (e.ChangedReason == SolutionChangedReason.Unload)
                {
                    this.UpdateTestContainersAndFileWatchers(files, false);
                }
            }

            // Do not fire OnTestContainersChanged here.
            // This will cause us to fire this event too early before the UTE is ready to process containers and will result in an exception.
            // The UTE will query all the TestContainerDiscoverers once the solution is loaded.
        }