public void ClearTests() { BindingSource binding = new BindingSource(); binding.AddNew(); SetGridDatasouce datasouce = SetDatasource; if (GridTests.InvokeRequired) { GridTests.Invoke(datasouce, new object[] { binding }); } else { GridTests.DataSource = binding; } cboFilter.Items.Clear(); cboFilter.Items.Add(Resources.FilterByAllTestsText); cboFilter.SelectedIndex = 0; lblTime.Text = ""; lblTestNum.Text = ""; lblTestDetails.Text = ""; lblProject.Text = ""; lblPassingTests.Text = ""; lblFailingTests.Text = ""; //check if a failurewindow exists and if it does clear it. TestFailure failureWindow = TestPackage.GetTestFailureWindow(); if (failureWindow != null) { failureWindow.Clear(); } }
/// <summary> /// Updates the Ctrl's GUI with the test infomation inside testInfo /// </summary> public void updateGTestInfomation(ConfiguredProject project, GTestResultCollection testInfo) { Contract.Requires(testInfo != null); UpdateSuitePicture updateSuitePicture = SuitePictureChange; Image image; AddProject(project); NumberOfTests = testInfo.TotalNumberOfTests; NumberOfFailingTests = testInfo.TotalNumberOfFailures; NumberOfPassingTests = NumberOfTests - NumberOfFailingTests; if (NumberOfPassingTests == 0 && NumberOfFailingTests == 0) { image = Resources.TestNotRun; } else { image = NumberOfFailingTests == 0 ? Resources.TestPassed : Resources.TestFail; } cboFilter.SetPropertyThreadSafe(() => cboFilter.SelectedIndex, 0); TimeTakenForTests = testInfo.TotalTime; if (picPass.InvokeRequired) { picPass.Invoke(updateSuitePicture, new object[] { image }); } else { updateSuitePicture(image); } BindingSource bindingSource = new BindingSource(); UpdateFilter addFilterItem = AddFilterItem; foreach (GTestSuite testSuite in testInfo.GetList()) { if (cboFilter.InvokeRequired) { cboFilter.Invoke(addFilterItem, new object[] { testSuite.Name }); } else { cboFilter.Items.Add(testSuite.Name); } foreach (GTestResult test in testSuite.GetList()) { bindingSource.Add(test); } } SetGridDatasouce datasouce = SetDatasource; if (GridTests.InvokeRequired) { GridTests.Invoke(datasouce, new object[] { bindingSource }); } else { GridTests.DataSource = bindingSource; } }