Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs =================================================================== diff -u -r03fd8f517a5e4d8636a7eec17c1abdef75f1ffe5 -r7d16dde6e8e3f63ded46bc1b474362806f517113 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision 03fd8f517a5e4d8636a7eec17c1abdef75f1ffe5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision 7d16dde6e8e3f63ded46bc1b474362806f517113) @@ -291,7 +291,13 @@ GrassCoverErosionOutwardsFailureMechanism failureMechanism = assessmentSection.GrassCoverErosionOutwards; Assert.AreEqual(15.0, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); - Assert.AreEqual(2, failureMechanism.HydraulicBoundaryLocations.Count); + HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase; + HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryDatabase.Locations[0]; + AssertHydraulicBoundaryLocationCalculationsWithoutIllustrationPoints(failureMechanism, hydraulicBoundaryLocation); + + HydraulicBoundaryLocation hydraulicBoundaryLocationWithIllustrationPoints = hydraulicBoundaryDatabase.Locations[1]; + AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(failureMechanism, hydraulicBoundaryLocationWithIllustrationPoints); + Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); var firstCalculationGroup = (CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[0]; @@ -569,12 +575,62 @@ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated); AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculation); - AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaterLevelCalculationsForSignalingNorm + AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightCalculationsForSignalingNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); } + private static void AssertHydraulicBoundaryLocationCalculationsWithoutIllustrationPoints(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated); + AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculation); + + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated); + AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculation); + + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + } + + private static void AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + HydraulicBoundaryLocationCalculation designWaterLevelCalculationWithIllustrationPoints = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + Assert.IsTrue(designWaterLevelCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated); + AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculationWithIllustrationPoints); + AssertGeneralResultTopLevelSubMechanismIllustrationPoint(designWaterLevelCalculationWithIllustrationPoints.Output.GeneralResult); + + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + + HydraulicBoundaryLocationCalculation waveHeightCalculationWithIllustrationPoints = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + Assert.IsTrue(waveHeightCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated); + AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculationWithIllustrationPoints); + AssertGeneralResultTopLevelSubMechanismIllustrationPoint(waveHeightCalculationWithIllustrationPoints.Output.GeneralResult); + + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation))); + } + private static void AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) { HydraulicBoundaryLocationCalculation designWaterLevelCalculationWithIllustrationPoints = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -r03fd8f517a5e4d8636a7eec17c1abdef75f1ffe5 -r7d16dde6e8e3f63ded46bc1b474362806f517113 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 03fd8f517a5e4d8636a7eec17c1abdef75f1ffe5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 7d16dde6e8e3f63ded46bc1b474362806f517113) @@ -95,10 +95,13 @@ } }; - assessmentSection.HydraulicBoundaryDatabase.Locations.AddRange(GetHydraulicBoundaryLocations()); - assessmentSection.SetHydraulicBoundaryLocationCalculations(assessmentSection.HydraulicBoundaryDatabase.Locations); - SetHydraulicBoundaryLocationCalculations(assessmentSection); + ObservableList hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + hydraulicBoundaryLocations.AddRange(GetHydraulicBoundaryLocations()); + assessmentSection.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocations); + assessmentSection.GrassCoverErosionOutwards.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocations); + ConfigureHydraulicBoundaryLocationCalculations(assessmentSection); + MacroStabilityInwardsFailureMechanism macroStabilityInwardsFailureMechanism = assessmentSection.MacroStabilityInwards; ConfigureMacroStabilityInwardsFailureMechanism(macroStabilityInwardsFailureMechanism, assessmentSection); AddSections(macroStabilityInwardsFailureMechanism); @@ -117,7 +120,7 @@ GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwardsFailureMechanism = assessmentSection.GrassCoverErosionOutwards; AddForeshoreProfiles(grassCoverErosionOutwardsFailureMechanism.ForeshoreProfiles); - ConfigureGrassCoverErosionOutwardsFailureMechanism(grassCoverErosionOutwardsFailureMechanism); + ConfigureGrassCoverErosionOutwardsFailureMechanism(grassCoverErosionOutwardsFailureMechanism, hydraulicBoundaryLocations); AddSections(grassCoverErosionOutwardsFailureMechanism); SetSectionResults(grassCoverErosionOutwardsFailureMechanism.SectionResults); @@ -332,68 +335,92 @@ yield return new HydraulicBoundaryLocation(13002, "test2", 135.2, 5293.8); } - private static void SetHydraulicBoundaryLocationCalculations(AssessmentSection assessmentSection) + private static void ConfigureHydraulicBoundaryLocationCalculations(AssessmentSection assessmentSection) { IEnumerable hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; HydraulicBoundaryLocation hydraulicLocationWithoutIllustrationPoints = hydraulicBoundaryLocations.ElementAt(0); - SetCalculationWithoutIllustrationPointOutput(assessmentSection, hydraulicLocationWithoutIllustrationPoints); + ConfigureCalculationsWithoutIllustrationPointOutput(assessmentSection, hydraulicLocationWithoutIllustrationPoints); HydraulicBoundaryLocation hydraulicLocationWithIllustrationPoints = hydraulicBoundaryLocations.ElementAt(1); - SetCalculationWithIllustrationPointOutput(assessmentSection, hydraulicLocationWithIllustrationPoints); + ConfigureCalculationsWithIllustrationPointOutput(assessmentSection, hydraulicLocationWithIllustrationPoints); } - private static void SetCalculationWithoutIllustrationPointOutput(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) + private static void ConfigureCalculationsWithoutIllustrationPointOutput(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) { - var designWaterLevelOutput = new HydraulicBoundaryLocationOutput(12.4, double.NaN, - double.NaN, double.NaN, - double.NaN, CalculationConvergence.CalculatedConverged, null); + const bool hasIllustrationPoints = false; + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - designWaterLevelCalculation.Output = designWaterLevelOutput; + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForLowerLimitNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - designWaterLevelCalculation.Output = designWaterLevelOutput; + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); - var waveHeightOutput = new HydraulicBoundaryLocationOutput(2.4, 0, 0, 0, 0, CalculationConvergence.CalculatedNotConverged, null); HydraulicBoundaryLocationCalculation waveHeightCalculation = assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - waveHeightCalculation.Output = waveHeightOutput; + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); waveHeightCalculation = assessmentSection.WaveHeightCalculationsForLowerLimitNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - waveHeightCalculation.Output = waveHeightOutput; + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); } - private static void SetCalculationWithIllustrationPointOutput(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) + private static void ConfigureCalculationsWithIllustrationPointOutput(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) { - var designWaterLevelOutput = new HydraulicBoundaryLocationOutput(12.4, double.NaN, - double.NaN, double.NaN, - double.NaN, CalculationConvergence.CalculatedConverged, - GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint()); + const bool hasIllustrationPoints = true; + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = true; - designWaterLevelCalculation.Output = designWaterLevelOutput; + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForLowerLimitNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = true; - designWaterLevelCalculation.Output = designWaterLevelOutput; + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); - var waveHeightOutput = new HydraulicBoundaryLocationOutput(2.4, 0, 0, 0, 0, CalculationConvergence.CalculatedNotConverged, - GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint()); HydraulicBoundaryLocationCalculation waveHeightCalculation = assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - waveHeightCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = true; - waveHeightCalculation.Output = waveHeightOutput; + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); waveHeightCalculation = assessmentSection.WaveHeightCalculationsForLowerLimitNorm .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); - waveHeightCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = true; - waveHeightCalculation.Output = waveHeightOutput; + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); } + private static void ConfigureDesignWaterLevelCalculation(HydraulicBoundaryLocationCalculation designWaterLevelCalculation, + bool hasIllustrationPoints) + { + designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = hasIllustrationPoints; + designWaterLevelCalculation.Output = GetDesignWaterLevelOutput(hasIllustrationPoints); + } + + private static void ConfigureWaveHeightCalculation(HydraulicBoundaryLocationCalculation waveHeightCalculation, + bool hasIllustrationPoints) + { + waveHeightCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = hasIllustrationPoints; + waveHeightCalculation.Output = GetWaveHeightOutput(hasIllustrationPoints); + } + + private static HydraulicBoundaryLocationOutput GetWaveHeightOutput(bool hasIllustrationPoints) + { + GeneralResult illustrationPoints = hasIllustrationPoints + ? GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint() + : null; + + return new HydraulicBoundaryLocationOutput(2.4, 0, 0, 0, 0, CalculationConvergence.CalculatedNotConverged, illustrationPoints); + } + + private static HydraulicBoundaryLocationOutput GetDesignWaterLevelOutput(bool hasIllustrationPoints) + { + GeneralResult illustrationPoints = hasIllustrationPoints + ? GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint() + : null; + + return new HydraulicBoundaryLocationOutput(12.4, double.NaN, + double.NaN, double.NaN, + double.NaN, CalculationConvergence.CalculatedConverged, illustrationPoints); + } + private static GeneralResult GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint() { var illustrationPointResult = new IllustrationPointResult("Description of result", 5); @@ -431,12 +458,6 @@ return (AssessmentLayerOneState) random.Next(1, Enum.GetValues(typeof(AssessmentLayerOneState)).Length + 1); } - private static AssessmentLayerTwoAResult GetAssessmentLayerTwoAResult() - { - var random = new Random(21); - return (AssessmentLayerTwoAResult) random.Next(1, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length + 1); - } - private static StructuresOutput GetStructuresOutputWithIllustrationPoints() { var random = new Random(56); @@ -1779,14 +1800,12 @@ #region GrassCoverErosionOutwards FailureMechanism - private static void ConfigureGrassCoverErosionOutwardsFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism) + private static void ConfigureGrassCoverErosionOutwardsFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + IEnumerable hydraulicBoundaryLocations) { failureMechanism.GeneralInput.N = (RoundedDouble) 15.0; + ConfigureHydraulicBoundaryLocationCalculations(failureMechanism, hydraulicBoundaryLocations); - ObservableList hydraulicBoundaryLocations = failureMechanism.HydraulicBoundaryLocations; - hydraulicBoundaryLocations.Add(new HydraulicBoundaryLocation(0, "HL 1", 100, 200)); - hydraulicBoundaryLocations.Add(new HydraulicBoundaryLocation(45, "HL 2", 123, 150)); - ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { @@ -1803,7 +1822,7 @@ InputParameters = { ForeshoreProfile = foreshoreProfile, - HydraulicBoundaryLocation = hydraulicBoundaryLocations[0], + HydraulicBoundaryLocation = hydraulicBoundaryLocations.ElementAt(0), BreakWater = { Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.3), @@ -1836,7 +1855,7 @@ InputParameters = { ForeshoreProfile = null, - HydraulicBoundaryLocation = hydraulicBoundaryLocations[1], + HydraulicBoundaryLocation = hydraulicBoundaryLocations.ElementAt(1), BreakWater = { Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.1), @@ -1859,6 +1878,43 @@ }); } + private static void ConfigureHydraulicBoundaryLocationCalculations(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + IEnumerable hydraulicBoundaryLocations) + { + HydraulicBoundaryLocation hydraulicLocationWithoutIllustrationPoints = hydraulicBoundaryLocations.ElementAt(0); + ConfigureCalculationsWithoutIllustrationPointOutput(failureMechanism, hydraulicLocationWithoutIllustrationPoints); + + HydraulicBoundaryLocation hydraulicLocationWithIllustrationPoints = hydraulicBoundaryLocations.ElementAt(1); + ConfigureCalculationsWithIllustrationPointOutput(failureMechanism, hydraulicLocationWithIllustrationPoints); + } + + private static void ConfigureCalculationsWithoutIllustrationPointOutput(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + const bool hasIllustrationPoints = false; + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + } + + private static void ConfigureCalculationsWithIllustrationPointOutput(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + const bool hasIllustrationPoints = true; + + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + } + private static void SetSectionResults(IEnumerable sectionResults) { foreach (GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult in sectionResults)