Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs =================================================================== diff -u -r8047e7fd59525ed424105aaefc4ee88b9ae8def6 -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision 8047e7fd59525ed424105aaefc4ee88b9ae8def6) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -22,6 +22,7 @@ using System; using Core.Common.Base; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Probability; using Ringtoets.HeightStructures.Data.Properties; namespace Ringtoets.HeightStructures.Data @@ -34,11 +35,21 @@ /// /// Creates a new instance of . /// - /// General grass cover erosion inwards calculation input parameters that apply to each calculation. - /// When is null. - public HeightStructuresCalculation(GeneralHeightStructuresInput generalInputParameters) + /// General height structures calculation input parameters that apply to each calculation. + /// General norm probabilistic parameters that apply to each + /// calculation. + /// Thrown when + /// is null. + /// is null. + /// + public HeightStructuresCalculation(GeneralHeightStructuresInput generalInputParameters, NormProbabilityInput normProbabilityInput) { + if (normProbabilityInput == null) + { + throw new ArgumentNullException("normProbabilityInput"); + } InputParameters = new HeightStructuresInput(generalInputParameters); + NormProbabilityInput = normProbabilityInput; Name = Resources.HeightStructuresCalculation_DefaultName; } @@ -48,6 +59,11 @@ public HeightStructuresInput InputParameters { get; private set; } /// + /// Gets the length-effect parameters. + /// + public NormProbabilityInput NormProbabilityInput { get; private set; } + + /// /// Gets or sets , which contains the results of a height structures calculation. /// public ProbabilisticOutput Output { get; set; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs =================================================================== diff -u -r4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -309,7 +309,7 @@ private static void AddCalculation(HeightStructuresCalculationGroupContext context) { - var calculation = new HeightStructuresCalculation(context.FailureMechanism.GeneralInput) + var calculation = new HeightStructuresCalculation(context.FailureMechanism.GeneralInput, context.FailureMechanism.NormProbabilityInput) { Name = NamingHelper.GetUniqueName(context.WrappedData.Children, HeightStructuresDataResources.HeightStructuresCalculation_DefaultName, c => c.Name) }; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs =================================================================== diff -u -r8047e7fd59525ed424105aaefc4ee88b9ae8def6 -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision 8047e7fd59525ed424105aaefc4ee88b9ae8def6) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -23,6 +23,7 @@ using Core.Common.Base; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Probability; namespace Ringtoets.HeightStructures.Data.Test { @@ -32,28 +33,47 @@ [Test] public void Constructor_NullGeneralInput_ThrowsArgumentNullException() { - // Setup & Call - TestDelegate test = () => new HeightStructuresCalculation(null); + // Setup + var normProbabilityInput = new NormProbabilityInput(); + // Call + TestDelegate test = () => new HeightStructuresCalculation(null, normProbabilityInput); + // Assert var exception = Assert.Throws(test); Assert.AreEqual("generalInputParameters", exception.ParamName); } [Test] + public void Constructor_NullNormProbabilityInput_ThrowsArgumentNullException() + { + // Setup + var generalInput = new GeneralHeightStructuresInput(); + + // Call + TestDelegate test = () => new HeightStructuresCalculation(generalInput, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("normProbabilityInput", exception.ParamName); + } + + [Test] public void Constructor_DefaultPropertyValuesAreSet() { // Setup var generalInput = new GeneralHeightStructuresInput(); + var normProbabilityInput = new NormProbabilityInput(); // Call - var calculation = new HeightStructuresCalculation(generalInput); + var calculation = new HeightStructuresCalculation(generalInput, normProbabilityInput); // Assert Assert.IsInstanceOf(calculation); Assert.IsInstanceOf(calculation); Assert.AreEqual("Nieuwe berekening", calculation.Name); Assert.IsNotNull(calculation.InputParameters); + Assert.AreEqual(normProbabilityInput, calculation.NormProbabilityInput); Assert.IsNull(calculation.Comments); Assert.IsFalse(calculation.HasOutput); } @@ -63,7 +83,8 @@ { // Setup var generalInput = new GeneralHeightStructuresInput(); - var calculation = new HeightStructuresCalculation(generalInput) + var normProbabilityInput = new NormProbabilityInput(); + var calculation = new HeightStructuresCalculation(generalInput, normProbabilityInput) { Output = new TestHeightStructuresOutput() }; @@ -80,7 +101,8 @@ { // Setup var generalInput = new GeneralHeightStructuresInput(); - var calculation = new HeightStructuresCalculation(generalInput) + var normProbabilityInput = new NormProbabilityInput(); + var calculation = new HeightStructuresCalculation(generalInput, normProbabilityInput) { Output = null }; @@ -94,7 +116,8 @@ { // Setup var generalInput = new GeneralHeightStructuresInput(); - var calculation = new HeightStructuresCalculation(generalInput) + var normProbabilityInput = new NormProbabilityInput(); + var calculation = new HeightStructuresCalculation(generalInput, normProbabilityInput) { Output = new TestHeightStructuresOutput() }; @@ -108,7 +131,8 @@ { // Setup var generalInput = new GeneralHeightStructuresInput(); - var calculation = new HeightStructuresCalculation(generalInput); + var normProbabilityInput = new NormProbabilityInput(); + var calculation = new HeightStructuresCalculation(generalInput, normProbabilityInput); // Call ICalculationInput input = calculation.GetObservableInput(); @@ -122,7 +146,8 @@ { // Setup var generalInput = new GeneralHeightStructuresInput(); - var calculation = new HeightStructuresCalculation(generalInput) + var normProbabilityInput = new NormProbabilityInput(); + var calculation = new HeightStructuresCalculation(generalInput, normProbabilityInput) { Output = new TestHeightStructuresOutput() }; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismTest.cs =================================================================== diff -u -rb60b7e12cf211bdbe11e0a54734fa097e8ef2146 -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismTest.cs (.../HeightStructuresFailureMechanismTest.cs) (revision b60b7e12cf211bdbe11e0a54734fa097e8ef2146) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismTest.cs (.../HeightStructuresFailureMechanismTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -25,6 +25,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Probability; namespace Ringtoets.HeightStructures.Data.Test { @@ -100,16 +101,17 @@ // Setup var mocks = new MockRepository(); var generalInput = new GeneralHeightStructuresInput(); + var normProbabilityInput = new NormProbabilityInput(); var failureMechanism = new HeightStructuresFailureMechanism { CalculationsGroup = { Children = { new CalculationGroup(), - new HeightStructuresCalculation(generalInput), + new HeightStructuresCalculation(generalInput, normProbabilityInput), mocks.StrictMock(), - new HeightStructuresCalculation(generalInput) + new HeightStructuresCalculation(generalInput, normProbabilityInput) } } }; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresCalculationContextTest.cs =================================================================== diff -u -rb60b7e12cf211bdbe11e0a54734fa097e8ef2146 -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresCalculationContextTest.cs (.../HeightStructuresCalculationContextTest.cs) (revision b60b7e12cf211bdbe11e0a54734fa097e8ef2146) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresCalculationContextTest.cs (.../HeightStructuresCalculationContextTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -44,7 +44,7 @@ { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput); var assessmentSectionMock = mocksRepository.StrictMock(); mocksRepository.ReplayAll(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -96,7 +96,7 @@ mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput); var calculationContext = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); // Call @@ -126,7 +126,7 @@ mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput) + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput) { Output = new TestHeightStructuresOutput() }; @@ -161,7 +161,7 @@ var treeViewControlMock = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); var assessmentSectionMock = mocks.StrictMock(); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput); var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); var menuBuilderMock = mocks.StrictMock(); @@ -200,7 +200,7 @@ var treeViewControlMock = mocks.StrictMock(); var failureMechanism = new HeightStructuresFailureMechanism(); var assessmentSectionMock = mocks.StrictMock(); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput); var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionMock); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -236,7 +236,7 @@ // Setup var group = new CalculationGroup(); var failureMechanism = new HeightStructuresFailureMechanism(); - var elementToBeRemoved = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var elementToBeRemoved = new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput); var observerMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var calculationContext = new HeightStructuresCalculationContext(elementToBeRemoved, @@ -251,7 +251,7 @@ mocks.ReplayAll(); group.Children.Add(elementToBeRemoved); - group.Children.Add(new HeightStructuresCalculation(failureMechanism.GeneralInput)); + group.Children.Add(new HeightStructuresCalculation(failureMechanism.GeneralInput, failureMechanism.NormProbabilityInput)); group.Attach(observerMock); // Precondition Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb60b7e12cf211bdbe11e0a54734fa097e8ef2146 -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision b60b7e12cf211bdbe11e0a54734fa097e8ef2146) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -116,7 +116,8 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var group = new CalculationGroup(); var childGroup = new CalculationGroup(); - var childCalculation = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var childCalculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, + failureMechanism.NormProbabilityInput); group.Children.Add(childGroup); group.Children.Add(calculationItemMock); @@ -379,7 +380,8 @@ var nodeData = new HeightStructuresCalculationGroupContext(group, failureMechanism, assessmentSectionMock); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput) + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, + failureMechanism.NormProbabilityInput) { Name = "Nieuwe berekening" }; @@ -461,7 +463,8 @@ var parentNodeData = new HeightStructuresCalculationGroupContext(parentGroup, failureMechanism, assessmentSectionMock); - var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput); + var calculation = new HeightStructuresCalculation(failureMechanism.GeneralInput, + failureMechanism.NormProbabilityInput); observerMock.Expect(o => o.UpdateObserver()); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs =================================================================== diff -u -rb60b7e12cf211bdbe11e0a54734fa097e8ef2146 -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision b60b7e12cf211bdbe11e0a54734fa097e8ef2146) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -27,6 +27,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Probability; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; using Ringtoets.HeightStructures.Plugin; @@ -79,10 +80,11 @@ { // Setup var generalInput = new GeneralHeightStructuresInput(); + var normProbabilityInput = new NormProbabilityInput(); var assessmentSectionMock = mocksRepository.StrictMock(); var heightStructuresInputContext = new HeightStructuresInputContext( new HeightStructuresInput(new GeneralHeightStructuresInput()), - new HeightStructuresCalculation(generalInput), + new HeightStructuresCalculation(generalInput, normProbabilityInput), new HeightStructuresFailureMechanism(), assessmentSectionMock); @@ -102,9 +104,10 @@ // Setup var assessmentSectionMock = mocksRepository.StrictMock(); var generalInput = new GeneralHeightStructuresInput(); + var normProbabilityInput = new NormProbabilityInput(); var heightStructuresInputContext = new HeightStructuresInputContext( new HeightStructuresInput(new GeneralHeightStructuresInput()), - new HeightStructuresCalculation(generalInput), + new HeightStructuresCalculation(generalInput, normProbabilityInput), new HeightStructuresFailureMechanism(), assessmentSectionMock); @@ -117,6 +120,7 @@ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); mocksRepository.VerifyAll(); + } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u -r20bb156dfc129b1602ddbcddc73c0806807f19ab -r7ddd944b70d252ae493bba48ea9b31c01634082d --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 20bb156dfc129b1602ddbcddc73c0806807f19ab) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 7ddd944b70d252ae493bba48ea9b31c01634082d) @@ -28,9 +28,6 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.GrassCoverErosionInwards.Data; -using Ringtoets.Integration.Data.StandAlone; -using Ringtoets.Piping.Data; using RingtoetsIntegrationResources = Ringtoets.Integration.Data.Properties.Resources; namespace Ringtoets.Integration.Data.Test @@ -91,7 +88,7 @@ duneErosionName, otherName }; - + var codes = new[] { pipingCode, @@ -151,6 +148,8 @@ Assert.AreEqual(30000.0, section.PipingFailureMechanism.NormProbabilityInput.Norm); Assert.AreEqual(double.NaN, section.PipingFailureMechanism.NormProbabilityInput.SectionLength); + Assert.AreEqual(30000.0, section.HeightStructures.NormProbabilityInput.Norm); + Assert.AreEqual(sum, section.FailureMechanismContribution.Distribution.Sum(d => d.Contribution)); } @@ -254,25 +253,6 @@ Assert.AreEqual(expectedNorm, otherContributionItem.ProbabilitySpace); } - private IFailureMechanism[] GetExpectedContributingFailureMechanisms(AssessmentSection section) - { - return new IFailureMechanism[] - { - section.PipingFailureMechanism, - section.GrassCoverErosionInwards, - section.MacrostabilityInwards, - section.StabilityStoneCover, - section.WaveImpactAsphaltCover, - section.GrassCoverErosionOutwards, - section.GrassCoverSlipOffOutwards, - section.HeightStructures, - section.ClosingStructure, - section.PipingStructure, - section.StrengthStabilityPointConstruction, - section.DuneErosion, - }; - } - [Test] [TestCase(AssessmentSectionComposition.Dike)] [TestCase(AssessmentSectionComposition.Dune)] @@ -347,6 +327,25 @@ Assert.AreEqual(double.NaN, assessmentSection.PipingFailureMechanism.NormProbabilityInput.SectionLength); } + private IFailureMechanism[] GetExpectedContributingFailureMechanisms(AssessmentSection section) + { + return new IFailureMechanism[] + { + section.PipingFailureMechanism, + section.GrassCoverErosionInwards, + section.MacrostabilityInwards, + section.StabilityStoneCover, + section.WaveImpactAsphaltCover, + section.GrassCoverErosionOutwards, + section.GrassCoverSlipOffOutwards, + section.HeightStructures, + section.ClosingStructure, + section.PipingStructure, + section.StrengthStabilityPointConstruction, + section.DuneErosion, + }; + } + private void AssertExpectedContributions(AssessmentSectionComposition composition, AssessmentSection assessmentSection) { double[] contributions = GetContributionsArray(composition);