Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs =================================================================== diff -u -r4e98433abe1e020a0579d7c6ed3a24a3e57ac677 -r70c00f8059b665d8677e5f667768ba7c7cfd3313 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision 4e98433abe1e020a0579d7c6ed3a24a3e57ac677) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision 70c00f8059b665d8677e5f667768ba7c7cfd3313) @@ -22,15 +22,12 @@ using System; using System.Linq; using Core.Common.Base; -using Core.Common.Util; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms.Builders; using Ringtoets.Common.Forms.Views; -using Ringtoets.Common.Primitives; using Ringtoets.StabilityPointStructures.Data; -using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.StabilityPointStructures.Forms.Views { @@ -41,6 +38,18 @@ public class StabilityPointStructuresFailureMechanismResultView : FailureMechanismResultView { + private const int simpleAssessmentResultIndex = 1; + private const int detailedAssessmentResultIndex = 2; + private const int detailedAssessmentProbabilityIndex = 3; + private const int tailorMadeAssessmentResultIndex = 4; + private const int tailorMadeAssessmentProbabilityIndex = 5; + private const int simpleAssemblyCategoryGroupIndex = 6; + private const int detailedAssemblyCategoryGroupIndex = 7; + private const int tailorMadeAssemblyCategoryGroupIndex = 8; + private const int combinedAssemblyCategoryGroupIndex = 9; + private const int combinedAssemblyProbabilityIndex = 10; + private const int manualAssemblyProbabilityIndex = 12; + private readonly IAssessmentSection assessmentSection; private readonly RecursiveObserver calculationInputObserver; private readonly RecursiveObserver calculationOutputObserver; @@ -88,9 +97,24 @@ protected override StabilityPointStructuresFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(StabilityPointStructuresFailureMechanismSectionResult sectionResult) { - return new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, - FailureMechanism, - assessmentSection); + return new StabilityPointStructuresFailureMechanismSectionResultRow( + sectionResult, + FailureMechanism, + assessmentSection, + new StabilityPointStructuresFailureMechanismSectionResultRow.ConstructionProperties + { + SimpleAssessmentResultIndex = simpleAssessmentResultIndex, + DetailedAssessmentResultIndex = detailedAssessmentResultIndex, + DetailedAssessmentProbabilityIndex = detailedAssessmentProbabilityIndex, + TailorMadeAssessmentResultIndex = tailorMadeAssessmentResultIndex, + TailorMadeAssessmentProbabilityIndex = tailorMadeAssessmentProbabilityIndex, + SimpleAssemblyCategoryGroupIndex = simpleAssemblyCategoryGroupIndex, + DetailedAssemblyCategoryGroupIndex = detailedAssemblyCategoryGroupIndex, + TailorMadeAssemblyCategoryGroupIndex = tailorMadeAssemblyCategoryGroupIndex, + CombinedAssemblyCategoryGroupIndex = combinedAssemblyCategoryGroupIndex, + CombinedAssemblyProbabilityIndex = combinedAssemblyProbabilityIndex, + ManualAssemblyProbabilityIndex = manualAssemblyProbabilityIndex + }); } protected override void Dispose(bool disposing) Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -re2f2a69303e75986c7bfa60744ad6766b460aefc -r70c00f8059b665d8677e5f667768ba7c7cfd3313 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs (.../StabilityPointStructuresFailureMechanismSectionResultRow.cs) (revision e2f2a69303e75986c7bfa60744ad6766b460aefc) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs (.../StabilityPointStructuresFailureMechanismSectionResultRow.cs) (revision 70c00f8059b665d8677e5f667768ba7c7cfd3313) @@ -54,10 +54,13 @@ /// so that it can be displayed as a row. /// The failure mechanism the result belongs to. /// The assessment section the result belongs to. + /// /// The property values required to create an instance of + /// . /// Thrown when any parameter is null. public StabilityPointStructuresFailureMechanismSectionResultRow(StabilityPointStructuresFailureMechanismSectionResult sectionResult, StabilityPointStructuresFailureMechanism failureMechanism, - IAssessmentSection assessmentSection) + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) : base(sectionResult) { if (failureMechanism == null) @@ -70,6 +73,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + this.failureMechanism = failureMechanism; this.assessmentSection = assessmentSection; @@ -330,5 +338,66 @@ CombinedAssemblyProbability = double.NaN; } } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -re2f2a69303e75986c7bfa60744ad6766b460aefc -r70c00f8059b665d8677e5f667768ba7c7cfd3313 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision e2f2a69303e75986c7bfa60744ad6766b460aefc) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision 70c00f8059b665d8677e5f667768ba7c7cfd3313) @@ -45,6 +45,27 @@ [TestFixture] public class StabilityPointStructuresFailureMechanismSectionResultRowTest { + private static StabilityPointStructuresFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties + { + get + { + return new StabilityPointStructuresFailureMechanismSectionResultRow.ConstructionProperties + { + SimpleAssessmentResultIndex = 1, + DetailedAssessmentResultIndex = 2, + DetailedAssessmentProbabilityIndex = 3, + TailorMadeAssessmentResultIndex = 4, + TailorMadeAssessmentProbabilityIndex = 5, + SimpleAssemblyCategoryGroupIndex = 6, + DetailedAssemblyCategoryGroupIndex = 7, + TailorMadeAssemblyCategoryGroupIndex = 8, + CombinedAssemblyCategoryGroupIndex = 9, + CombinedAssemblyProbabilityIndex = 10, + ManualAssemblyProbabilityIndex = 11 + }; + } + } + [Test] public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() { @@ -57,7 +78,8 @@ var result = new StabilityPointStructuresFailureMechanismSectionResult(section); // Call - TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(result, null, assessmentSection); + TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(result, null, assessmentSection, + ConstructionProperties); // Assert var exception = Assert.Throws(call); @@ -74,14 +96,37 @@ // Call TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow( - result, new StabilityPointStructuresFailureMechanism(), null); + result, new StabilityPointStructuresFailureMechanism(), null, ConstructionProperties); // Assert var exception = Assert.Throws(call); Assert.AreEqual("assessmentSection", exception.ParamName); } [Test] + public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new StabilityPointStructuresFailureMechanismSectionResult(section); + + // Call + TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(result, + new StabilityPointStructuresFailureMechanism(), + assessmentSection, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("constructionProperties", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] public void Constructor_WithParameters_ExpectedValues() { // Setup @@ -97,7 +142,8 @@ // Call using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection); + var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection, + ConstructionProperties); // Assert Assert.IsInstanceOf>(row); @@ -151,7 +197,8 @@ random.NextEnumValue()); // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection); + var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection, + ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -197,7 +244,8 @@ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly( random.NextDouble(), random.NextEnumValue()); - var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection); + var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection, + ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -245,7 +293,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, failureMechanism, assessmentSection); + result, failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssemblyProbability; bool newValue = !originalValue; @@ -282,7 +330,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, failureMechanism, assessmentSection); + result, failureMechanism, assessmentSection, ConstructionProperties); // Call row.ManualAssemblyProbability = value; @@ -314,7 +362,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, failureMechanism, assessmentSection); + result, failureMechanism, assessmentSection, ConstructionProperties); // Call TestDelegate test = () => row.ManualAssemblyProbability = value; @@ -344,7 +392,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection); + var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection, + ConstructionProperties); // Call StructuresCalculation calculation = row.GetSectionResultCalculation(); @@ -375,7 +424,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection); + var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection, + ConstructionProperties); // Call StructuresCalculation calculation = row.GetSectionResultCalculation(); @@ -411,7 +461,8 @@ { var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, - assessmentSection); + assessmentSection, + ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -444,7 +495,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, failureMechanism, assessmentSection); + result, failureMechanism, assessmentSection, ConstructionProperties); // Call row.DetailedAssessmentResult = newValue; @@ -473,7 +524,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection, + ConstructionProperties); // Call double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; @@ -510,7 +562,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection, + ConstructionProperties); // Call double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; @@ -544,7 +597,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection, + ConstructionProperties); // Call double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; @@ -577,7 +631,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, failureMechanism, assessmentSection); + result, failureMechanism, assessmentSection, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; @@ -612,7 +666,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, new StabilityPointStructuresFailureMechanism(), assessmentSection); + result, new StabilityPointStructuresFailureMechanism(), assessmentSection, ConstructionProperties); // Call row.TailorMadeAssessmentProbability = value; @@ -644,7 +698,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { var row = new StabilityPointStructuresFailureMechanismSectionResultRow( - result, new StabilityPointStructuresFailureMechanism(), assessmentSection); + result, new StabilityPointStructuresFailureMechanism(), assessmentSection, ConstructionProperties); // Call TestDelegate test = () => row.TailorMadeAssessmentProbability = value;