private void BtnStartClick(object sender, RoutedEventArgs e) { if (lstViewTestcases.SelectedItems.Count == 0 || languages.SelectedItems.Count == 0 || lstBrowser.SelectedItems.Count == 0) { ShowErrorMessage("You must select at least one test, one language and one browser. At least one of them is missing.", "Missing arguments!"); return; } SetSelectedItems(languages); SetSelectedItems(lstBrowser); List <string> selectedBrowsersLocal = lstBrowser.SelectedItems.OfType <CheckBox>().Select(checkBox => checkBox.Tag.ToString()).ToList(); List <string> selectedLanguages = languages.SelectedItems.Cast <CheckBox>().Where(checkBox => checkBox.IsChecked.HasValue && checkBox.IsChecked.Value).Select(checkBox => checkBox.Tag.ToString()).ToList(); List <string> selectedTestcases = lstViewTestcases.SelectedItems.Cast <string>().ToList(); _localTestLogic.SetAppSetting("TestcaseFilter", txtFilter.Text); _localTestLogic.SetAppSetting("TestcaseFile", txtFile.Text); _localTestLogic.SetAppSetting("Testsystem", txtTestsystem.Text); _localTestLogic.SetAppSetting("Language", string.Join("|", selectedLanguages)); _localTestLogic.SetAppSetting("Browser", string.Join("|", lstBrowser.SelectedItems.Cast <CheckBox>().Where(checkBox => checkBox.IsChecked.HasValue && checkBox.IsChecked.Value).Select(checkBox => checkBox.Tag.ToString()))); _localTestLogic.SetAppSetting("Testcase", string.Join("|", lstViewTestcases.SelectedItems.Cast <string>())); string testsystem = txtTestsystem.Text; LoadTestcaseFile(txtFile.Text); if (selectedBrowsersLocal.Any()) { TestLocal(testsystem, selectedBrowsersLocal, selectedTestcases, selectedLanguages); } }
private void BtnStartClick(object sender, RoutedEventArgs e) { if (lstViewTestcases.SelectedItems.Count == 0 || languages.SelectedItems.Count == 0 || lstBrowser.SelectedItems.Count == 0) { ShowErrorMessage("You must select at least one test, one language and one browser. At least one of them is missing.", "Missing arguments!"); return; } SetSelectedItems(languages); SetSelectedItems(lstBrowser); List <string> selectedBrowsersLocal = new List <string>(); List <string> selectedBrowsersRemote = new List <string>(); foreach (object selectedObject in lstBrowser.SelectedItems) { CheckBox checkBox = selectedObject as CheckBox; if (checkBox != null) { string selectedBrowser = checkBox.Tag.ToString(); if (selectedBrowser.StartsWith(LocalPrefix)) { selectedBrowsersLocal.Add(selectedBrowser.Substring(LocalPrefix.Length)); } if (selectedBrowser.StartsWith(RemotePrefix)) { selectedBrowsersRemote.Add(selectedBrowser.Substring(RemotePrefix.Length)); } } } List <string> selectedLanguages = languages.SelectedItems.Cast <CheckBox>().Where(checkBox => checkBox.IsChecked.HasValue && checkBox.IsChecked.Value).Select(checkBox => checkBox.Tag.ToString()).ToList(); List <string> selectedTestcases = lstViewTestcases.SelectedItems.Cast <string>().ToList(); _localTestLogic.SetAppSetting("TestcaseFilter", txtFilter.Text); _localTestLogic.SetAppSetting("TestcaseFile", txtFile.Text); _localTestLogic.SetAppSetting("Testsystem", txtTestsystem.Text); _localTestLogic.SetAppSetting("Language", string.Join("|", selectedLanguages)); _localTestLogic.SetAppSetting("Browser", string.Join("|", lstBrowser.SelectedItems.Cast <CheckBox>().Where(checkBox => checkBox.IsChecked.HasValue && checkBox.IsChecked.Value).Select(checkBox => checkBox.Tag.ToString()))); _localTestLogic.SetAppSetting("Testcase", string.Join("|", lstViewTestcases.SelectedItems.Cast <string>())); string testsystem = txtTestsystem.Text; string fileName = txtFile.Text; LoadTestcaseFile(txtFile.Text); if (selectedBrowsersLocal.Any()) { TestLocal(testsystem, selectedBrowsersLocal, selectedTestcases, selectedLanguages); } if (selectedBrowsersRemote.Any()) { TestRemote(fileName, testsystem, selectedBrowsersRemote, selectedTestcases, selectedLanguages); } }