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); }
private static string ComparisonValue( IWebDriver driver, ResultCheck resultCheck) { var context = new ContextForAutoTest(); if (resultCheck.CheckType.Equals(CheckTypes.Regex)) { if (Regex.IsMatch(resultCheck.ExecutionValue, resultCheck.ExpectedValue)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.Existance)) { resultCheck.ExecutionValue = resultCheck.ExecutionValue == null ? "ExistanceFalse" : "ExistanceTrue"; if (resultCheck.ExecutionValue.Equals(resultCheck.ExpectedValue)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.HasClass)) { if (HasClass(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.HasNotClass)) { if (!HasClass(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.ReadOnly)) { resultCheck.ExecutionValue = ReadOnly(driver, resultCheck); if (resultCheck.ExecutionValue.Equals(resultCheck.ExpectedValue)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.DataRequiredTrue)) { if (DataRequired(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.DataRequiredFalse)) { if (!DataRequired(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanReadRecordOnGrid)) { if (CanReadRecordOnGrid(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanNotReadRecordOnGrid)) { if (!CanReadRecordOnGrid(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanUpdateRecordOnEditor)) { if (CanReadRecordOnEditor(driver, resultCheck) && CanUpdateRecordOnEditor(driver)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanReadRecordOnEditor)) { if (CanReadRecordOnEditor(driver, resultCheck) && !CanUpdateRecordOnEditor(driver)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanNotReadRecordOnEditor)) { if (!CanReadRecordOnEditor(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanCrossSearchRecord)) { if (CanCrossSearchRecord(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.CanNotCrossSearchRecord)) { if (!CanCrossSearchRecord(driver, resultCheck)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.SelectOptions)) { if (SelectOptions(driver, resultCheck, resultCheck.ExecutionValue)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else if (resultCheck.CheckType.Equals(CheckTypes.Label)) { resultCheck.ExecutionValue = GetLabelText(driver, resultCheck); if (resultCheck.ExecutionValue.Equals(resultCheck.ExpectedValue)) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } else { if (resultCheck.ExecutionValue == resultCheck.ExpectedValue) { return(Displays.AutoTestResultOk(context: context)); } else { return(Displays.AutoTestResultNg(context: context)); } } }