Example #1
0
        private static bool CheckTestPartsJson()
        {
            var context = new ContextForAutoTest();
            var result  = true;

            Parameters.ExtendedAutoTestScenarios
            .Select((autoTestScenario, i) => new { Index = i + 1, Data = autoTestScenario })
            .ForEach(autoTestScenario =>
            {
                Console.WriteLine(Displays.AutoTestCasesList(
                                      context: context,
                                      data: new string[]
                {
                    autoTestScenario.Index.ToString(),
                    autoTestScenario.Data.CaseName,
                    autoTestScenario.Data.CasesDescription
                }));
                autoTestScenario.Data.TestCases
                .ForEach(testCase =>
                {
                    var testPartsList = new List <string>();
                    Parameters.ExtendedAutoTestOperations
                    .ForEach(testParts =>
                    {
                        testPartsList.Add(testParts.TestPartsPath);
                    });
                    string partCheck = null;
                    if ((!testCase.TestPartsName.IsNullOrEmpty()) &&
                        (!testPartsList.Contains($"{testCase.TestPartsPath}\\{testCase.TestPartsName}")))
                    {
                        if (result)
                        {
                            result = false;
                        }
                        partCheck = Displays.AutoTestResultNg(context: context);
                    }
                    string partMessage = !testCase.TestPartsName.IsNullOrEmpty() ?
                                         $"\\{testCase.TestPartsName}" : "\\*";
                    Console.WriteLine(Displays.AutoTestPartsList(
                                          context: context,
                                          data: new string[]
                    {
                        testCase.TestPartsPath,
                        partMessage,
                        partCheck
                    }));
                });
            });
            if (!result)
            {
                Console.WriteLine(Displays.AutoTestFileDescribed(context: context));
            }
            return(result);
        }