private void OnAddTestProject(TestProjectInfo testProject) { TestProjectShip newTestProjectShip = new TestProjectShip(eventAggregator, testResultsRepository, executor, dialogService, testProject); bool inserted = false; for (int i = 0; i < this.TestProjectShips.Count; i++) { if (string.Compare(newTestProjectShip.Name, this.TestProjectShips[i].Name) <= 0) { this.TestProjectShips.Insert(i, newTestProjectShip); inserted = true; break; } } if (!inserted) { this.TestProjectShips.Add(newTestProjectShip); } newTestProjectShip.TestProjectInfo.SaveToFile(this.configClass.GetConfigValue(Constants.DefaultRunsettingsFile), this.configClass.GetEncoding()); if (newTestProjectShip.TestProjectInfo.Location != this.configClass.GetConfigValue(Constants.LastTestProjectsPath)) { this.configClass.SetConfigValue(Constants.LastTestProjectsPath, newTestProjectShip.TestProjectInfo.Location); } }
public void SelectedItemChanged(object selectedItem) { TestProjectShip testProject = selectedItem as TestProjectShip; if (testProject != null) { this.eventAggregator.GetEvent <TestProjectSelectedEvent>().Publish(testProject.TestProjectInfo); return; } TestAssembly assembly = selectedItem as TestAssembly; if (assembly != null) { this.eventAggregator.GetEvent <TestAssemblySelectedEvent>().Publish(assembly); return; } TestCaseInfo testCase = selectedItem as TestCaseInfo; if (testCase != null) { this.eventAggregator.GetEvent <TestMethodSelectedEvent>().Publish(testCase); return; } }
private void OnCloseTestProject(TestProjectInfo testProjectInfo) { testProjectInfo.SaveToFile(this.configClass.GetConfigValue(Constants.DefaultRunsettingsFile), this.configClass.GetEncoding()); TestProjectShip projectShip = this.TestProjectShips.FirstOrDefault(o => o.Name == testProjectInfo.Name); if (projectShip != null) { this.TestProjectShips.Remove(projectShip); } }
private void OnRenameTestProject(string[] names) { Debug.Assert(names.Length == 2); string originalName = names[0]; string newName = names[1]; try { TestProjectShip project = this.TestProjectShips.First(x => x.Name == newName); if (project != null) { TestProjectInfo projectInfo = project.TestProjectInfo; projectInfo.Rename(originalName, this.configClass.GetConfigValue(Constants.DefaultRunsettingsFile), this.configClass.GetEncoding()); } } catch (InvalidOperationException) { } }
private void OnTestProjectConfiguration(string projectName) { TestProjectShip project = this.TestProjectShips.First(x => x.Name == projectName); this.dialogService.ShowTestProjectConfigurationDialog(project.TestProjectInfo); }