Пример #1
0
        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>();
            }
        }
Пример #2
0
 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>();
     }
 }
Пример #3
0
        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;
                }
            }
        }
Пример #4
0
        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;
                }
            }
        }
Пример #5
0
        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;
                    }
                }
            }
        }