Index: System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.cs =================================================================== diff -u -r3e35ac8865d3303751def1967203a03dca8f6f74 -re10bb4368540b7c65c712f099f7ff34dfba75689 --- System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.cs (.../AutomatedSystemTestsRepository.cs) (revision 3e35ac8865d3303751def1967203a03dca8f6f74) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.cs (.../AutomatedSystemTestsRepository.cs) (revision e10bb4368540b7c65c712f099f7ff34dfba75689) @@ -2144,6 +2144,7 @@ AutomatedSystemTestsRepositoryFolders.HydraulicBCDunesFolder _hydraulicbcdunes; AutomatedSystemTestsRepositoryFolders.AssemblyResultFolder _assemblyresult; AutomatedSystemTestsRepositoryFolders.AssemblyResultsCategoryViewFolder _assemblyresultscategoryview; + AutomatedSystemTestsRepositoryFolders.AssemblySectionsViewFolder _assemblysectionsview; RepoItemInfo _btndialogInfo; RepoItemInfo _dropdownbuttoninrowpropertiespanelInfo; RepoItemInfo _tablevakindelingInfo; @@ -2162,6 +2163,7 @@ _hydraulicbcdunes = new AutomatedSystemTestsRepositoryFolders.HydraulicBCDunesFolder(this); _assemblyresult = new AutomatedSystemTestsRepositoryFolders.AssemblyResultFolder(this); _assemblyresultscategoryview = new AutomatedSystemTestsRepositoryFolders.AssemblyResultsCategoryViewFolder(this); + _assemblysectionsview = new AutomatedSystemTestsRepositoryFolders.AssemblySectionsViewFolder(this); _btndialogInfo = new RepoItemInfo(this, "BtnDialog", "?/?/button[@controlname='btnDialog']", 30000, null, "cefba828-ea6b-4e9d-a97a-641324e9af42"); _dropdownbuttoninrowpropertiespanelInfo = new RepoItemInfo(this, "DropDownButtonInRowPropertiesPanel", "?/?/button[@controlname='btnDropDown']", 30000, null, "3bf645bc-b589-440e-9827-e97c895e810b"); _tablevakindelingInfo = new RepoItemInfo(this, "TableVakindeling", "?/?/table[@controlname='dataGridView']", 30000, null, "e1c75820-980f-411c-9ada-a9dcd59572ae"); @@ -2334,6 +2336,15 @@ { get { return _assemblyresultscategoryview; } } + + /// + /// The AssemblySectionsView folder. + /// + [RepositoryFolder("5a151305-72de-45f8-b2e3-6fcfc226f361")] + public virtual AutomatedSystemTestsRepositoryFolders.AssemblySectionsViewFolder AssemblySectionsView + { + get { return _assemblysectionsview; } + } } /// @@ -4411,6 +4422,72 @@ } /// + /// The AssemblySectionsViewFolder folder. + /// + [RepositoryFolder("5a151305-72de-45f8-b2e3-6fcfc226f361")] + public partial class AssemblySectionsViewFolder : RepoGenBaseFolder + { + RepoItemInfo _tableInfo; + + /// + /// Creates a new AssemblySectionsView folder. + /// + public AssemblySectionsViewFolder(RepoGenBaseFolder parentFolder) : + base("AssemblySectionsView", "container[@controlname='AssemblyResultPerSectionView']", parentFolder, 30000, null, false, "5a151305-72de-45f8-b2e3-6fcfc226f361", "") + { + _tableInfo = new RepoItemInfo(this, "Table", "container/table", 30000, null, "e21708c5-fec0-48a4-a781-9a094d1d956a"); + } + + /// + /// The Self item. + /// + [RepositoryItem("5a151305-72de-45f8-b2e3-6fcfc226f361")] + public virtual Ranorex.Container Self + { + get + { + return _selfInfo.CreateAdapter(true); + } + } + + /// + /// The Self item info. + /// + [RepositoryItemInfo("5a151305-72de-45f8-b2e3-6fcfc226f361")] + public virtual RepoItemInfo SelfInfo + { + get + { + return _selfInfo; + } + } + + /// + /// The Table item. + /// + [RepositoryItem("e21708c5-fec0-48a4-a781-9a094d1d956a")] + public virtual Ranorex.Table Table + { + get + { + return _tableInfo.CreateAdapter(true); + } + } + + /// + /// The Table item info. + /// + [RepositoryItemInfo("e21708c5-fec0-48a4-a781-9a094d1d956a")] + public virtual RepoItemInfo TableInfo + { + get + { + return _tableInfo; + } + } + } + + /// /// The DocumentViewContainerFolder folder. /// [RepositoryFolder("78b3cba4-3858-49b9-8809-b7f79f03aa5c")] Index: System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.rximg =================================================================== diff -u -r3e35ac8865d3303751def1967203a03dca8f6f74 -re10bb4368540b7c65c712f099f7ff34dfba75689 Binary files differ Index: System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.rxrep =================================================================== diff -u -r3e35ac8865d3303751def1967203a03dca8f6f74 -re10bb4368540b7c65c712f099f7ff34dfba75689 --- System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.rxrep (.../AutomatedSystemTestsRepository.rxrep) (revision 3e35ac8865d3303751def1967203a03dca8f6f74) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTestsRepository.rxrep (.../AutomatedSystemTestsRepository.rxrep) (revision e10bb4368540b7c65c712f099f7ff34dfba75689) @@ -1008,6 +1008,25 @@ /form[@automationid='RiskeerMainWindow']/?/container[10]/container[@controltypename='WinFormsAdapter']/container[@controlname='AssemblyResultCategoriesView'] + + + /form[@automationid='RiskeerMainWindow']/?/container[10]/container[@controltypename='WinFormsAdapter']/container[@controlname='AssemblyResultPerSectionView']/container/table + + + /form[@automationid='RiskeerMainWindow']/?/container[10]/container[@controltypename='WinFormsAdapter']/container[@controlname='AssemblyResultPerSectionView'] + + /form[@automationid='RiskeerMainWindow']/?/container[10]/container[@controltypename='WinFormsAdapter'] Index: System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ReadSectionsDivisionsFromSectionsView.cs =================================================================== diff -u -r3e35ac8865d3303751def1967203a03dca8f6f74 -re10bb4368540b7c65c712f099f7ff34dfba75689 --- System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ReadSectionsDivisionsFromSectionsView.cs (.../ReadSectionsDivisionsFromSectionsView.cs) (revision 3e35ac8865d3303751def1967203a03dca8f6f74) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ReadSectionsDivisionsFromSectionsView.cs (.../ReadSectionsDivisionsFromSectionsView.cs) (revision e10bb4368540b7c65c712f099f7ff34dfba75689) @@ -204,7 +204,7 @@ } /// - /// Label fo the FM + /// Label of the FM /// public string Label{get; set;} Index: System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateAssemblyTrajectView.cs =================================================================== diff -u -r4e8b69f608d2d86c0c717657207d6e3403d6f592 -re10bb4368540b7c65c712f099f7ff34dfba75689 --- System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateAssemblyTrajectView.cs (.../ValidateAssemblyTrajectView.cs) (revision 4e8b69f608d2d86c0c717657207d6e3403d6f592) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateAssemblyTrajectView.cs (.../ValidateAssemblyTrajectView.cs) (revision e10bb4368540b7c65c712f099f7ff34dfba75689) @@ -78,18 +78,26 @@ string expectedAssessmentProb1and2 = CalculateAssessmentProbabilityGroups1and2(trajectAssessmentInformation); string actualAssessmentProb1and2 = summaryTraject.AssessmentProbabilityGroups1And2.TextValue; - ValidateAssessmentProb1and2(actualAssessmentProb1and2, expectedAssessmentProb1and2); + ValidateAreEqualWithMessage(actualAssessmentProb1and2, expectedAssessmentProb1and2, "Validation Assembly probability groups 1 and 2."); + string expectedAssessmentLabel1and2 = CalculateAssessmentLabelGroups1and2(expectedAssessmentProb1and2, categoryBoundariesTraject); string actualAssessmentLabel1and2 = summaryTraject.AssessmentLabelGroups1And2.TextValue; - ValidateAssessmentLabel1and2(actualAssessmentLabel1and2, expectedAssessmentProb1and2, categoryBoundariesTraject); + ValidateAreEqualWithMessage(actualAssessmentLabel1and2, expectedAssessmentLabel1and2, "Validation Assembly Label groups 1 and 2."); + string expectedAssessmentLabel3and4 = CalculateAssessmentLabelGroups3and4(trajectAssessmentInformation); + string actualAssessmentLabel3and4 = summaryTraject.AssessmentGroups3And4.TextValue; + ValidateAreEqualWithMessage(actualAssessmentLabel1and2, expectedAssessmentLabel1and2, "Validation Assembly Label groups 3 and 4."); + + string expectedSecurityAssessmentLabel = CalculateSecurityAssessmentLabel(expectedAssessmentLabel1and2, expectedAssessmentLabel3and4); + string actualSecurityAssessmentLabel = summaryTraject.SecurityAssessment.TextValue; + ValidateAreEqualWithMessage(actualSecurityAssessmentLabel, expectedSecurityAssessmentLabel, "Validation Security Assembly Label."); + } - private void ValidateAssessmentLabel1and2(string actualValue, string expectedProb, string categoryBoundariesTraject) + private void ValidateAreEqualWithMessage(string actualValue, string expectedValue, string message) { - string expectedAssessmentLabel1and2 = CalculateAssessmentLabelGroups1and2(expectedProb, categoryBoundariesTraject); - Report.Info("Validating Assembly probability groups 1 and 2..."); - Validate.AreEqual(actualValue, expectedAssessmentLabel1and2); + Report.Info(message); + Validate.AreEqual(actualValue, expectedValue); } private string CalculateAssessmentLabelGroups1and2(string expectedProb, string categoryBoundariesTraject) @@ -128,49 +136,79 @@ } } - private string CalculateSecurityAssessmentLabel(string expectedProb, string categoryBoundariesTraject, TrajectAssessmentInformation trjAssInfo) + private string CalculateAssessmentLabelGroups3and4(TrajectAssessmentInformation trjAssInfo) { - if (expectedProb=="1/Oneindig") { - return "C"; - } else { - System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture; - var boundaries = categoryBoundariesTraject.Split(';').ToList(); - var boundariesValues = boundaries.Select(bd=>1.0/Double.Parse(bd.Substring(2,bd.Length-2), currentCulture)).ToList(); - boundariesValues.Add(1.0); - double expectedProbValue = 1.0/Double.Parse(expectedProb.Substring(2, expectedProb.Length-2), currentCulture); - string label = ""; - var indexFirstBoundaryAbove = boundariesValues.FindIndex(bd=>bd>expectedProbValue); - switch (indexFirstBoundaryAbove) { - case 0: - label = "It"; - break; - case 1: - label = "IIt"; - break; - case 2: - label = "IIIt"; - break; - case 3: - label = "IVt"; - break; - case 4: - label = "Vt"; - break; - case 5: - label = "VIt"; - break; + Dictionary dicAssemblyLabels = new Dictionary { + {"-", 0}, + {"It", 1}, + {"IIt", 2}, + {"IIIt", 3}, + {"IVt", 4}, + {"Vt", 5}, + {"VIt", 6}, + {"VIIt", 7} + }; + int maxLabel = 0; + string labelGroup3and4 =""; + var trjAssInfoFMsGroup3and4 = trjAssInfo.ListFMsAssessmentInformation.Where(tai=>tai.Group==3 || tai.Group==4); + foreach (var fmTrjAssInfo in trjAssInfoFMsGroup3and4) { + if (dicAssemblyLabels[fmTrjAssInfo.AssessmentLabel]>maxLabel) { + maxLabel = dicAssemblyLabels[fmTrjAssInfo.AssessmentLabel]; + labelGroup3and4 = fmTrjAssInfo.AssessmentLabel; } - return label; } + return labelGroup3and4; } - + private string CalculateSecurityAssessmentLabel(string expectedLabel12, string expectedLabel34) + { + Dictionary dicAssemblyLabels = new Dictionary { + {"-", 0}, + {"It", 1}, + {"IIt", 2}, + {"IIIt", 3}, + {"IVt", 4}, + {"Vt", 5}, + {"VIt", 6}, + {"VIIt", 7} + }; + int value12 = dicAssemblyLabels[expectedLabel12]; + int value34 = dicAssemblyLabels[expectedLabel34]; + int labelValueWorst = -1; + if (value12>value34) { + labelValueWorst = value12; + } else{ + labelValueWorst = value34; + } + + switch (labelValueWorst) { + case 0: + return "NGO"; + case 1: + return "A+"; + case 2: + return "A"; + case 3: + return "B"; + case 4: + return "C"; + case 5: + return "C"; + case 6: + return "D"; + case 7: + return "NGO"; + default: + return "ERROR"; + } + } + private void ValidateAssessmentProb1and2(string actualValue, string expectedValue) { Report.Info("Validating Assembly probability groups 1 and 2..."); Validate.AreEqual(actualValue, expectedValue); } - + private string CalculateAssessmentProbabilityGroups1and2(TrajectAssessmentInformation trjAssInfo) { System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture; @@ -188,11 +226,12 @@ return "1/Oneindig"; } else { double prob = 1 - productInvProbs; - string denominator = (1/prob).ToString(currentCulture); + int denomInt= Convert.ToInt32(1/prob); + string denominator = String.Format("{0:n0}", denomInt); return "1/" + denominator; } } - + private void ValidateTableAssemblyTrajectView(Table table, TrajectAssessmentInformation trjAssInfo) { var headerRow = table.Rows[0]; @@ -210,7 +249,7 @@ Report.Info("Validation for FM = " + currentFM); Report.Info("Validating group..."); row.Cells[indexGroup].Select(); - Validate.AreEqual(GetAV(row.Cells[indexGroup]), assInfo.Group); + Validate.AreEqual(GetAV(row.Cells[indexGroup]), assInfo.Group.ToString()); Report.Info("Validating assessment label..."); row.Cells[indexAssessmentLabel].Select(); Validate.AreEqual(GetAV(row.Cells[indexAssessmentLabel]), assInfo.AssessmentLabel); Index: System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateSectionsCombinationsView.cs =================================================================== diff -u -r3e35ac8865d3303751def1967203a03dca8f6f74 -re10bb4368540b7c65c712f099f7ff34dfba75689 --- System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateSectionsCombinationsView.cs (.../ValidateSectionsCombinationsView.cs) (revision 3e35ac8865d3303751def1967203a03dca8f6f74) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateSectionsCombinationsView.cs (.../ValidateSectionsCombinationsView.cs) (revision e10bb4368540b7c65c712f099f7ff34dfba75689) @@ -7,6 +7,8 @@ * To change this template use Tools > Options > Coding > Edit standard headers. */ using System; +using System.Globalization; +using System.Linq; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; @@ -57,12 +59,92 @@ Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0.0; - + System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture; + var trajectAssessmentInformation = BuildAssessmenTrajectInformation(trajectAssessmentInformationString); var repo = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; - + + var table = repo.RiskeerMainWindow.DocumentViewContainerUncached.AssemblySectionsView.Table; + List allSubsections = new List(); + allSubsections.Add(0); + foreach (var fmTrjAssInfo in trajectAssessmentInformation.ListFMsAssessmentInformation) { + foreach (var section in fmTrjAssInfo.SectionList) { + allSubsections.Add(section.EndDistance); + } + } + allSubsections.Sort(); + var allSubsectionsUnique = allSubsections.Distinct().ToList(); + var rowsToIterate = table.Rows.ToList(); + var headerRow = rowsToIterate[0]; + + List fmsToValidate = trajectAssessmentInformation.ListFMsAssessmentInformation.Select(it=>it.Label).ToList(); + int indexSectionNumber = GetIndex(headerRow, "Vaknummer"); + int indexDistanceStart = GetIndex(headerRow, "van* [m]"); + int indexDistanceEnd = GetIndex(headerRow, "tot* [m]"); + int indexCombinedAssessment = GetIndex(headerRow, "Gecombineerd"); + List indecesColumnsFMsToValidate = fmsToValidate.Select(fmLabel=>GetIndex(headerRow, fmLabel)).ToList(); + + Dictionary dicAssemblyLabels = new Dictionary { + {"-", 0}, + {"Iv", 1}, + {"IIv", 2}, + {"IIIv", 3}, + {"IVv", 4}, + {"Vv", 5}, + {"VIv", 6}, + {"VIIv", 7} + }; + + rowsToIterate.RemoveAt(0); + int indexRow = 0; + foreach (var row in rowsToIterate) { + var cells = row.Cells.ToList(); + double expectedDistanceStart = allSubsectionsUnique[indexRow]; + double expectedDistanceEnd = allSubsectionsUnique[indexRow + 1]; + double expectedDistanceMiddle = (expectedDistanceStart + expectedDistanceEnd)/2.0; + string CombinedAssessmentSectionLabel = ""; + int worstFMLabel = 0; + for (int i = 0; i < fmsToValidate.Count; i++) { + var currentFMAssInfo = trajectAssessmentInformation.ListFMsAssessmentInformation[i]; + var expectedFMAssessmentLabel = GetAssessmentLabelForDistance(currentFMAssInfo, expectedDistanceMiddle); + if (dicAssemblyLabels[expectedFMAssessmentLabel]>worstFMLabel) { + worstFMLabel = dicAssemblyLabels[expectedFMAssessmentLabel]; + CombinedAssessmentSectionLabel = expectedFMAssessmentLabel; + } + } + Report.Info("Validation for row " + (indexRow + 1).ToString() + "."); + ValidateCell(cells[indexSectionNumber], (indexRow + 1).ToString(), "Validation section number."); + ValidateCell(cells[indexDistanceStart], expectedDistanceStart.ToString("N2"), "Validation section start"); + ValidateCell(cells[indexDistanceEnd], expectedDistanceEnd.ToString("N2"), "Validation section end"); + ValidateCell(cells[indexCombinedAssessment], CombinedAssessmentSectionLabel, "Validation combined assessment label."); + + + for (int i = 0; i < fmsToValidate.Count; i++) { + var currentFMAssInfo = trajectAssessmentInformation.ListFMsAssessmentInformation[i]; + var expectedFMAssessmentLabel = GetAssessmentLabelForDistance(currentFMAssInfo, expectedDistanceMiddle); + + ValidateCell(cells[indecesColumnsFMsToValidate[i]], expectedFMAssessmentLabel, "Validation assessment label FM " + fmsToValidate[i]); + } + indexRow++; + } } + private void ValidateCell(Cell cell, string expectedValue, string message) + { + Report.Info(message); + cell.Select(); + string actualValue = GetAV(cell); + Validate.AreEqual(actualValue, expectedValue); + } + + private string GetAssessmentLabelForDistance(FailureMechanismAssessmentInformation fmAssInfo, double distance) + { + var endSections = fmAssInfo.SectionList.Select(it=>it.EndDistance).ToList(); + int index = endSections.FindIndex(it=> distanceGetAV(cl).Contains(name)); + } + } } Index: System tests/AutomatedSystemTests/AutomatedSystemTests/WorkOnProgressDavid.rxtst =================================================================== diff -u -r3e35ac8865d3303751def1967203a03dca8f6f74 -re10bb4368540b7c65c712f099f7ff34dfba75689 --- System tests/AutomatedSystemTests/AutomatedSystemTests/WorkOnProgressDavid.rxtst (.../WorkOnProgressDavid.rxtst) (revision 3e35ac8865d3303751def1967203a03dca8f6f74) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/WorkOnProgressDavid.rxtst (.../WorkOnProgressDavid.rxtst) (revision e10bb4368540b7c65c712f099f7ff34dfba75689) @@ -421,6 +421,7 @@ - - - - - - - -