// ------------------------------------------------------ /// <summary> /// Tries to add the specified code element to the CxxTest Suites /// window. Does nothing if the window is not yet created. /// </summary> /// <param name="element"> /// The VC code model element to be added. /// </param> public void TryToAddElementToTestSuitesWindow(CodeElement element) { CxxTestSuitesToolWindow window = FindToolWindow(typeof(CxxTestSuitesToolWindow), 0, false) as CxxTestSuitesToolWindow; if (window != null) { window.AddElement(element); } }
// ------------------------------------------------------ /// <summary> /// Tries to refresh the CxxTest Suites window with the test suites /// currently in the solution. Does nothing if the window is not yet /// created. /// </summary> public void TryToRefreshTestSuitesWindow() { CxxTestSuitesToolWindow window = FindToolWindow(typeof(CxxTestSuitesToolWindow), 0, false) as CxxTestSuitesToolWindow; if (window != null) { window.RefreshFromSolution(); } }
// ------------------------------------------------------ /// <summary> /// Tries to delete the specified element in the CxxTest Suites /// window. Does nothing if the window is not yet created. /// </summary> /// <param name="parent"> /// The parent of the element that was deleted. /// </param> /// <param name="element"> /// The element that was deleted. /// </param> public void TryToDeleteElementToTestSuitesWindow(object parent, CodeElement element) { CxxTestSuitesToolWindow window = FindToolWindow(typeof(CxxTestSuitesToolWindow), 0, false) as CxxTestSuitesToolWindow; if (window != null) { window.DeleteElement(parent, element); } }
// ------------------------------------------------------ /// <summary> /// Tries to change the specified element in the CxxTest Suites /// window. Does nothing if the window is not yet created. /// </summary> /// <param name="element"> /// The element that was changed. /// </param> /// <param name="changeKind"> /// The kind of change that occurred. /// </param> public void TryToChangeElementToTestSuitesWindow(CodeElement element, vsCMChangeKind changeKind) { CxxTestSuitesToolWindow window = FindToolWindow(typeof(CxxTestSuitesToolWindow), 0, false) as CxxTestSuitesToolWindow; if (window != null) { window.ChangeElement(element, changeKind); } }
// ------------------------------------------------------ /// <summary> /// Asks the CxxTest Suites tool window which test cases should be /// run, based on the user's selection. /// </summary> /// <returns> /// A dictionary containing all of the test cases currently available /// in the solution. The keys are the C++ qualified names of the test /// cases (TestClass::TestMethod), and the values are a boolean /// indicating whether or not the test should be run. /// </returns> public Dictionary <string, bool> TryToGetTestsToRun() { CxxTestSuitesToolWindow window = FindToolWindow(typeof(CxxTestSuitesToolWindow), 0, false) as CxxTestSuitesToolWindow; if (window != null) { return(window.SelectedTestCases); } else { return(new Dictionary <string, bool>()); } }