private void SelectedMethodsInScenario() { if (!string.IsNullOrEmpty(SelectedScenarioName)) { int index = Convert.ToInt32(SelectedScenarioName.Replace("Scenario ", string.Empty)) - 1; var sc = Test.TestPackage.Scenarios.ElementAt(index); sc.ScenarioOrder = sc.ScenarioOrder.OrderBy(o => o.Order).ToList(); List <MethodForScenario> selectedMethodsList = sc.ScenarioOrder.Select(c => new MethodForScenario() { MethodName = c.MethodName, MethodGuid = c.MethodGuid, AssemblyGuid = c.AssemblyGuid, IsRest = c.IsRest } ).ToList(); SelectedMethods = selectedMethodsList; } else { SelectedMethods = new List <MethodForScenario>(); } }
public void DeleteScenario() { if (!string.IsNullOrEmpty(SelectedScenarioName)) { int index = Convert.ToInt32(SelectedScenarioName.Replace("Scenario ", string.Empty)) - 1; if (Test.TestPackage.Scenarios.Count > 0) { Test.TestPackage.Scenarios.RemoveAt(index); } LoadScenarios(); SelectedMethods = new List <MethodForScenario>(); AvailableMethods = new List <MethodForScenario>(); } }
public void RemoveFromSelected() { if (!string.IsNullOrEmpty(SelectedScenarioName)) { int scenarioIndex = Convert.ToInt32(SelectedScenarioName.Replace("Scenario ", string.Empty)) - 1; if (SelectedSelectedMethodName != null && !string.IsNullOrEmpty(SelectedSelectedMethodName.MethodName) && SelectedSelectedMethodIndex > -1) { List <MethodForScenario> tempselectedMethods = _selectedMethods.ToList(); tempselectedMethods.RemoveAt(SelectedSelectedMethodIndex); SetScenarioOrder(scenarioIndex, tempselectedMethods); SelectedMethods = tempselectedMethods; } } }
public void AddToSelected() { if (!string.IsNullOrEmpty(SelectedScenarioName)) { int scenarioIndex = Convert.ToInt32(SelectedScenarioName.Replace("Scenario ", string.Empty)) - 1; if (SelectedAvailableMethodName != null && !string.IsNullOrEmpty(SelectedAvailableMethodName.MethodName)) { List <MethodForScenario> tempselectedMethods = _selectedMethods.ToList(); List <MethodForScenario> tempavailableMethods = _availableMethods.ToList(); tempselectedMethods.Add(SelectedAvailableMethodName); SetScenarioOrder(scenarioIndex, tempselectedMethods); SelectedMethods = tempselectedMethods; AvailableMethods = tempavailableMethods; } } }
public void MoveSelectedDown() { if (!string.IsNullOrEmpty(SelectedScenarioName)) { int scenarioIndex = Convert.ToInt32(SelectedScenarioName.Replace("Scenario ", string.Empty)) - 1; if (SelectedSelectedMethodName != null && !string.IsNullOrEmpty(SelectedSelectedMethodName.MethodName) && SelectedSelectedMethodIndex > -1) { if (SelectedSelectedMethodIndex < SelectedMethods.Count - 1) { List <MethodForScenario> tempselectedMethods = _selectedMethods.ToList(); var old = tempselectedMethods[SelectedSelectedMethodIndex + 1]; tempselectedMethods[SelectedSelectedMethodIndex + 1] = tempselectedMethods[SelectedSelectedMethodIndex]; tempselectedMethods[SelectedSelectedMethodIndex] = old; SetScenarioOrder(scenarioIndex, tempselectedMethods); SelectedMethods = tempselectedMethods; } } } }