private IEnumerable <TestFileCandidate> FindPotentialTestFiles(IVsProject project) { string projectPath = VsSolutionHelper.GetProjectPath(project); try { return((from item in VsSolutionHelper.GetProjectItems(project) where HasTestFileExtension(item) select new TestFileCandidate { Path = item }).ToList()); } finally { } }
// 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. }