Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs =================================================================== diff -u -re5b6ddb7a02c006c9bb38838ac95627b6346571a -r73ce73546dd3805de5a1dcedf8dea86671899302 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs (.../MacroStabilityOutwardsSectionResultRow.cs) (revision e5b6ddb7a02c006c9bb38838ac95627b6346571a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs (.../MacroStabilityOutwardsSectionResultRow.cs) (revision 73ce73546dd3805de5a1dcedf8dea86671899302) @@ -38,6 +38,17 @@ /// public class MacroStabilityOutwardsSectionResultRow : FailureMechanismSectionResultRow { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + private readonly MacroStabilityOutwardsFailureMechanism failureMechanism; private readonly IAssessmentSection assessmentSection; @@ -48,10 +59,13 @@ /// so that it can be displayed as a row. /// The failure mechanism the section result belongs to. /// The assessment section the section result belongs to. + /// The property values required to create an instance of + /// . /// Thrown when any parameter is null. public MacroStabilityOutwardsSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResult sectionResult, MacroStabilityOutwardsFailureMechanism failureMechanism, - IAssessmentSection assessmentSection) + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) : base(sectionResult) { if (failureMechanism == null) @@ -64,9 +78,25 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + this.failureMechanism = failureMechanism; this.assessmentSection = assessmentSection; + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + Update(); } @@ -247,5 +277,61 @@ failureMechanism, assessmentSection); } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Gets or sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Gets or sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Gets or sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Gets or sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Gets or sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Gets or sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Gets or sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Gets or sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Gets or sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Gets or sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs =================================================================== diff -u -r712c1aad8e5486980f259491130e4ae07ea48149 -r73ce73546dd3805de5a1dcedf8dea86671899302 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision 712c1aad8e5486980f259491130e4ae07ea48149) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision 73ce73546dd3805de5a1dcedf8dea86671899302) @@ -77,7 +77,21 @@ protected override MacroStabilityOutwardsSectionResultRow CreateFailureMechanismSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResult sectionResult) { - return new MacroStabilityOutwardsSectionResultRow(sectionResult, FailureMechanism, assessmentSection); + return new MacroStabilityOutwardsSectionResultRow( + sectionResult, FailureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties + { + SimpleAssessmentResultIndex = simpleAssessmentResultIndex, + DetailedAssessmentResultIndex = detailedAssessmentResultIndex, + DetailedAssessmentProbabilityIndex = detailedAssessmentProbabilityIndex, + TailorMadeAssessmentResultIndex = tailorMadeAssessmentResultIndex, + TailorMadeAssessmentProbabilityIndex = tailorMadeAssessmentProbabilityIndex, + SimpleAssemblyCategoryGroupIndex = simpleAssemblyCategoryGroupIndex, + DetailedAssemblyCategoryGroupIndex = detailedAssemblyCategoryGroupIndex, + TailorMadeAssemblyCategoryGroupIndex = tailorMadeAssemblyCategoryGroupIndex, + CombinedAssemblyCategoryGroupIndex = combinedAssemblyCategoryGroupIndex, + ManualAssemblyCategoryGroupIndex = manualAssemblyCategoryGroupIndex + }); } protected override void AddDataGridColumns() Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs =================================================================== diff -u -re5b6ddb7a02c006c9bb38838ac95627b6346571a -r73ce73546dd3805de5a1dcedf8dea86671899302 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision e5b6ddb7a02c006c9bb38838ac95627b6346571a) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision 73ce73546dd3805de5a1dcedf8dea86671899302) @@ -56,7 +56,8 @@ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); // Call - TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, null, assessmentSection); + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, null, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Assert string paramName = Assert.Throws(test).ParamName; @@ -72,14 +73,33 @@ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); // Call - TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, new MacroStabilityOutwardsFailureMechanism(), null); + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, new MacroStabilityOutwardsFailureMechanism(), null, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Assert string paramName = Assert.Throws(test).ParamName; Assert.AreEqual("assessmentSection", paramName); } [Test] + public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() + { + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); + + // Call + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, new MacroStabilityOutwardsFailureMechanism(), assessmentSection, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("constructionProperties", exception.ParamName); + } + + [Test] public void Constructor_WithParameters_ExpectedValues() { // Setup @@ -95,7 +115,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Assert Assert.IsInstanceOf>(row); @@ -132,12 +153,13 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Assert Assert.Throws(test); @@ -163,7 +185,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Precondition Assert.IsFalse(result.UseManualAssemblyCategoryGroup); @@ -198,7 +221,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -222,7 +246,7 @@ var observer = mocks.StrictMock(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); - + var random = new Random(39); var newValue = random.NextEnumValue(); @@ -232,7 +256,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call row.SimpleAssessmentResult = newValue; @@ -264,7 +289,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call row.DetailedAssessmentResult = newValue; @@ -298,7 +324,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call row.DetailedAssessmentProbability = value; @@ -329,7 +356,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call TestDelegate test = () => row.DetailedAssessmentProbability = value; @@ -363,7 +391,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call row.TailorMadeAssessmentResult = newValue; @@ -397,7 +426,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call row.TailorMadeAssessmentProbability = value; @@ -428,7 +458,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); // Call TestDelegate test = () => row.TailorMadeAssessmentProbability = value; @@ -460,7 +491,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -490,8 +522,9 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); - + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -520,7 +553,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -550,7 +584,8 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + new MacroStabilityOutwardsSectionResultRow.ConstructionProperties()); var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;