Пример #1
0
        private static (List <int>, bool) CheckPreExecution(string executeType)
        {
            var context  = new ContextForAutoTest();
            var testList = new List <int>();

            if (Parameters.ExtendedAutoTestSettings.Url.IsNullOrEmpty())
            {
                Parameters.ExtendedAutoTestSettings.Url = InputUrl();
            }
            if (CheckTestPartsJson() == false)
            {
                Console.ReadKey(intercept: true);
                return(null, false);
            }
            Console.WriteLine(Displays.AutoTestNumberSelect(context: context));
            Console.WriteLine(Displays.AutoTestTargetPartsMessage(context: context));
            Console.Write(Displays.AutoTestArrow(context: context));
            if (!executeType.Contains("select"))
            {
                Parameters.ExtendedAutoTestScenarios
                .Select((autoTestScenario, i) => new { Index = i })
                .ForEach(autoTestScenario =>
                {
                    testList.Add(autoTestScenario.Index);
                });
            }
            else
            {
                try
                {
                    testList = Console.ReadLine()
                               .Split(',')
                               .Select(selectNumber => int.Parse(selectNumber) - 1)
                               .ToList();
                    Console.Write(Displays.AutoTestNumber(context: context));
                }
                catch
                {
                    Console.WriteLine(Displays.AutoTestInputErrorHalfNumber(context: context));
                    Console.ReadKey(intercept: true);
                    return(null, false);
                }
            }
            foreach (var list in testList)
            {
                Console.Write($"{list + 1},");
            }
            Console.WriteLine(Displays.AutoTestSelected(context: context));
            Console.WriteLine(Displays.AutoTestConfirmRun(context: context));
            Console.WriteLine(Displays.AutoTestRunning(context: context));
            return(testList, true);
        }