protected void GenerateTestsClick(object CommandaBarControl, ref bool handled, ref bool cancelDefault) { if(m_NCrunchMenu == null) {m_NCrunchMenu = ((CommandBars) _applicationObject.CommandBars)["NCrunch"];} //m_FinishedNCrunchSearch.Set(); foreach (var selectedProject in this.GetSelectedProjects()) { this._applicationObject.Solution.SolutionBuild.BuildProject(_applicationObject.Solution.SolutionBuild.ActiveConfiguration.Name, selectedProject.UniqueName, true); if (this._applicationObject.Solution.SolutionBuild.LastBuildInfo == 0) { var testProject = this.AddTestProject(selectedProject); var testAssembly = this.GetAssembly(selectedProject); var tester = new Tester(); foreach (var type in testAssembly.GetTypes()) { var testSuite = tester.GenerateTests(type); AddTestSuiteToProject(testSuite, testProject); //m_FinishedNCrunchSearch.WaitOne(); if (m_NCrunchMenu != null) { var disableCommand = m_NCrunchMenu.Controls["Disable"]; var enableCommand = m_NCrunchMenu.Controls["Enable"]; disableCommand.Execute(); enableCommand.Execute(); } } } } }