public static TestRunProxy TestRunModelToProxy(TestRun run) { TestRunProxy runProxy = new TestRunProxy(); runProxy.ID = run.ID; runProxy.Name = run.Name; runProxy.CreatedBy = run.CreatedBy; runProxy.CreatedOn = run.CreatedOn; IEnumerable<TestComposite> compositeModel = new TestRunManager().GetCompositeByRunId(runProxy.ID); foreach (TestComposite comp in compositeModel) { ExtendedTestCaseProxy extendedTestCaseProxy = new ExtendedTestCaseProxy(); extendedTestCaseProxy.Status = EnumUtil.ParseEnum<Status>(comp.TestCaseStatus); TestCase testCase = new TestManager().GetById(comp.TestCaseID); extendedTestCaseProxy.Id = testCase.ID; extendedTestCaseProxy.Title = testCase.Title; extendedTestCaseProxy.Priority = EnumUtil.ParseEnum<Priority>(testCase.Priority); extendedTestCaseProxy.Severity = EnumUtil.ParseEnum<Severity>(testCase.Severity); extendedTestCaseProxy.IsAutomated = testCase.IsAutomated; extendedTestCaseProxy.CreatedBy = testCase.CreatedBy; extendedTestCaseProxy.UpdatedBy = testCase.UpdatedBy; extendedTestCaseProxy.AreaID = testCase.AreaID; foreach (var item in new TestManager().GetStepDefinitionsById(testCase.ID)) { StepDefinitionProxy proxy = new StepDefinitionProxy(); proxy.Step = item.Step; proxy.ExpectedResult = item.ExpectedResult; proxy.ID = item.ID; proxy.TestCaseID = item.TestCaseID; extendedTestCaseProxy.StepDefinitionList.Add(proxy); } runProxy.TestCasesList.Add(extendedTestCaseProxy); } return runProxy; }
private void UpdateTestRun(TestRunProxy selectedTestRun) { TestRunProxyManager manager = new TestRunProxyManager(); TestRunProxy updatedTestRun = manager.GetById(selectedTestRun.ID); selectedTestRun.TestCasesList = updatedTestRun.TestCasesList; this.OnSelectedItem(this, null); }
private void PromptDialog_Loaded(object sender, RoutedEventArgs e) { // Initial DB data retrieve Task task = Task.Factory.StartNew(() => { TestRunProxyManager testRunManager = new TestRunProxyManager(); this.TestRunProxy = testRunManager.GetById(RunId); ProjectProxyManager proxyManager = new ProjectProxyManager(); this.ProjectProxyList = proxyManager.GetAll(); }); task.ContinueWith(next => { // Update the main Thread as it is the owner of the UI elements this.Dispatcher.Invoke((Action)(() => { foreach (var testCase in this.TestRunProxy.TestCasesList) { ProjectProxy projectProxy = this.ProjectProxyList.Where(proj => proj.Areas.Any(a => a.ID == testCase.AreaID)).FirstOrDefault(); if (projectProxy != null) { AreaProxy areaProxy = projectProxy.Areas.Where(a => a.ID == testCase.AreaID).FirstOrDefault(); if (areaProxy != null) { TestCaseProxy testCaseToRemove = areaProxy.TestCasesList.Where(tc => tc.Id == testCase.Id).FirstOrDefault(); if (testCaseToRemove != null) areaProxy.TestCasesList.Remove(testCaseToRemove); } } } this.SetCurrentAccentColor(); this.ProjectTreeView.ItemsSource = this.ProjectProxyList; this.TestCasesList = this.TestRunProxy.TestCasesList; this.SelectedTestCasesList.ItemsSource = this.TestCasesList; this.TestRunList.Visibility = Visibility.Visible; this.progressBar.Visibility = Visibility.Hidden; })); }); }
private void PromptDialog_Loaded(object sender, RoutedEventArgs e) { // Initial DB data retrieve Task task = Task.Factory.StartNew(() => { TestRunProxyManager testRunManager = new TestRunProxyManager(); this.TestRunProxy = testRunManager.GetById(RunId); }); task.ContinueWith(next => { // Update the main Thread as it is the owner of the UI elements this.Dispatcher.Invoke((Action)(() => { this.SetCurrentAccentColor(); this.CurrentTestCaseLabel.Content = string.Format("1/{0}", this.TestRunProxy.TestCasesList.Count()); // Map to dictionary for easier manipulation foreach (ExtendedTestCaseProxy testCase in this.TestRunProxy.TestCasesList) { runStatus[testCase] = testCase.Status; } // Starting run point this.CurrentSelectedTestCase = this.TestRunProxy.TestCasesList.FirstOrDefault(); this.CurrentTestCaseIndex = 0; // Index this.SetCurrentTestCase(CurrentSelectedTestCase); this.runStatus[CurrentSelectedTestCase] = CurrentSelectedTestCase.Status; this.StatusComboBox.SelectedIndex = (int)this.runStatus[CurrentSelectedTestCase]; })); }); }