private TrajectResultInformation BuildAssessmenTrajectInformation(string trajectAssessmentInformationString) { TrajectResultInformation trajectAssessmentInformation; if (trajectAssessmentInformationString == "") { trajectAssessmentInformation = new TrajectResultInformation(); } else { var error = false; trajectAssessmentInformation = JsonConvert.DeserializeObject <TrajectResultInformation>(trajectAssessmentInformationString, new JsonSerializerSettings { Error = (s, e) => { error = true; e.ErrorContext.Handled = true; } } ); if (error == true) { Report.Log(ReportLevel.Error, "error unserializing json string for trajectAssessmentInformationString: " + trajectAssessmentInformationString); } } return(trajectAssessmentInformation); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { var failureProbText = AutomatedSystemTestsRepository.Instance.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.FM_ResultView.FailureProbabilityFM.Element; failureProbText.SetAttributeValue("AccessibleValue", ManualFailureProbToSet); var trajectResultInformation = TrajectResultInformation.BuildAssessmenTrajectInformation(trajectAssessmentInformationString); trajectResultInformation.ListFMsResultInformation.Where(fmItem => fmItem.Label == currentFMLabel).FirstOrDefault().FailureProbability = ManualFailureProbToSet; failureProbText.As <Text>().PressKeys("{Return}"); trajectAssessmentInformationString = JsonConvert.SerializeObject(trajectResultInformation, Formatting.Indented); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { var repo = AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; var tableFailureProbsFMs = repo.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.SecurityAssemblyView.Table.Self; var trajectResultInformation = TrajectResultInformation.BuildAssessmenTrajectInformation(trajectAssessmentInformationString); var infoCurrentFM = trajectResultInformation.ListFMsResultInformation.Where(fmItem => fmItem.Label == labelFM).FirstOrDefault(); var expectedFailureProbability = infoCurrentFM == null?"-":infoCurrentFM.FailureProbability.ToNoGroupSeparator(); var row = tableFailureProbsFMs.Rows[Int32.Parse(rowIndex) - 1]; ValidateCell(row.Cells[1], nameFM.ReplacePathAliases()); ValidateCell(row.Cells[2], labelFM); ValidateCell(row.Cells[3], expectedFailureProbability); }
private string CalculateFailureProbTraject(TrajectResultInformation trajectResultInformation) { double productInverseProbs = 1.0; foreach (var fmInfo in trajectResultInformation.ListFMsResultInformation) { var denomFailureProb = fmInfo.FailureProbability.ToNoGroupSeparator().Substring(2); productInverseProbs = productInverseProbs * (1.0 - 1.0 / Double.Parse(denomFailureProb)); } var probTraject = 1 - productInverseProbs; var denomProbTraject = Convert.ToInt32(1 / probTraject).ToString(); return("1/" + denomProbTraject); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { var trajectAssessmentInformation = TrajectResultInformation.BuildAssessmenTrajectInformation(trajectAssessmentInformationString); var tableRows = AutomatedSystemTestsRepository.Instance.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.SecurityCategoriesViewTable.Rows; tableRows.RemoveAt(0); foreach (var row in tableRows) { var cellUpperLimit = row.Cells[4]; cellUpperLimit.Focus(); cellUpperLimit.Select(); trajectAssessmentInformation.UpperLimitsSecurityBoundaries.Add(cellUpperLimit.Text.ToNoGroupSeparator()); } trajectAssessmentInformationString = JsonConvert.SerializeObject(trajectAssessmentInformation, Formatting.Indented); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { this.trajectResultInformation = TrajectResultInformation.BuildAssessmenTrajectInformation(trajectAssessmentInformationString); this.allSubsections = CreateSubsections(trajectResultInformation.ListFMsResultInformation); var rowsTable = AutomatedSystemTests.AutomatedSystemTestsRepository.Instance.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.AssemblySectionsView.Table.Self.Rows; this.listAllLabelsFMs = rowsTable[0].Cells.Select(cell => cell.Text).Where(txt => txt != "").Where(txt => !txt.Contains("Metrering")).Where(txt => !txt.Contains("Slechtste duidingsklasse")).ToList(); rowsTable.RemoveAt(0); int indexRow = 0; foreach (var row in rowsTable) { ValidateRowSectionsCombinations(row, indexRow); indexRow++; } }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0; var fmAssessmentInformation = new FailureMechanismResultInformation(); fmAssessmentInformation.Label = labelFM; var repo = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; var rowsSectionsDivisions = repo.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.FMSectionsViewTable.Rows; var sectionIndeces = GetColumnIndecesSectionsView(rowsSectionsDivisions[0]); rowsSectionsDivisions.RemoveAt(0); foreach (var row in rowsSectionsDivisions) { fmAssessmentInformation.SectionList.Add(CreateSectionFromRow(row, sectionIndeces)); } var trajectAssessmentInformation = TrajectResultInformation.BuildAssessmenTrajectInformation(trajectAssessmentInformationString); trajectAssessmentInformation.ListFMsResultInformation.Add(fmAssessmentInformation); trajectAssessmentInformationString = JsonConvert.SerializeObject(trajectAssessmentInformation, Formatting.Indented); }