Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -0,0 +1,228 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using log4net; +using Ringtoets.HydraRing.Data; +using Ringtoets.Piping.Data.Probabilistics; +using Ringtoets.Piping.Data.Properties; +using Ringtoets.Piping.InputParameterCalculation; +using Ringtoets.Piping.Primitives; + +namespace Ringtoets.Piping.Data +{ + /// + /// Class responsible for calculating the derived piping input. + /// + public class DerivedPipingInput + { + private const double seepageLengthStandardDeviationFraction = 0.1; + private static readonly ILog log = LogManager.GetLogger(typeof(DerivedPipingInput)); + + private readonly PipingInput input; + + /// + /// Creates a new instance of . + /// + /// The input to calculate the derived piping input. + /// Thrown when is null. + public DerivedPipingInput(PipingInput input) + { + if (input == null) + { + throw new ArgumentNullException("input", "Cannot create DerivedPipingInput without PipingInput."); + } + this.input = input; + } + + /// + /// Gets the assessment level from the . + /// + public RoundedDouble AssessmentLevel + { + get + { + return input.HydraulicBoundaryLocation == null ? + new RoundedDouble(2, double.NaN) : + new RoundedDouble(2, input.HydraulicBoundaryLocation.DesignWaterLevel); + } + } + + /// + /// Gets the piezometric head exit. + /// + public RoundedDouble PiezometricHeadExit + { + get + { + RoundedDouble piezometricHeadExit; + try + { + var assessmentLevel = input.AssessmentLevel; + var dampingFactorExit = PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(); + var phreaticLevelExit = PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(); + + piezometricHeadExit = (RoundedDouble) InputParameterCalculationService.CalculatePiezometricHeadAtExit(assessmentLevel, dampingFactorExit, phreaticLevelExit); + } + catch (ArgumentOutOfRangeException) + { + piezometricHeadExit = (RoundedDouble) double.NaN; + } + + return new RoundedDouble(2, piezometricHeadExit); + } + } + + /// + /// Gets the seepage length. + /// + public LognormalDistribution SeepageLength + { + get + { + LognormalDistribution seepageLenght = new LognormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) double.NaN + }; + try + { + seepageLenght.Mean = input.ExitPointL - input.EntryPointL; + } + catch (ArgumentOutOfRangeException) + { + seepageLenght.Mean = (RoundedDouble) double.NaN; + } + seepageLenght.StandardDeviation = seepageLenght.Mean * seepageLengthStandardDeviationFraction; + + return seepageLenght; + } + } + + /// + /// Gets the thickness coverage layer. + /// + public LognormalDistribution ThicknessCoverageLayer + { + get + { + LognormalDistribution thicknessCoverageLayer = new LognormalDistribution(2) + { + Mean = (RoundedDouble)double.NaN, + StandardDeviation = (RoundedDouble) 0.5 + }; + if (input.SurfaceLine != null && input.SoilProfile != null & !double.IsNaN(input.ExitPointL)) + { + TrySetThicknessCoverageLayer(thicknessCoverageLayer); + + if (double.IsNaN(thicknessCoverageLayer.Mean)) + { + log.Warn(Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer); + } + } + else + { + thicknessCoverageLayer.Mean = (RoundedDouble) double.NaN; + } + + return thicknessCoverageLayer; + } + } + + /// + /// gets the thickness aquifer layer. + /// + public LognormalDistribution ThicknessAquiferLayer + { + get + { + LognormalDistribution thicknesAquiferLayer = new LognormalDistribution(2) + { + Mean = (RoundedDouble)double.NaN, + StandardDeviation = (RoundedDouble) 0.5 + }; + + PipingSoilProfile soilProfile = input.SoilProfile; + RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine; + double exitPointL = input.ExitPointL; + + if (soilProfile != null && surfaceLine != null && !double.IsNaN(exitPointL)) + { + double thicknessTopAquiferLayer = GetThicknessTopAquiferLayer(soilProfile, surfaceLine, exitPointL); + TrySetThicknessAquiferLayerMean(thicknesAquiferLayer, thicknessTopAquiferLayer); + + if (double.IsNaN(thicknesAquiferLayer.Mean)) + { + log.Warn(Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer); + } + } + else + { + thicknesAquiferLayer.Mean = (RoundedDouble)double.NaN; + } + + return thicknesAquiferLayer; + } + } + + private static void TrySetThicknessAquiferLayerMean(LognormalDistribution thicknesAquiferLayer, double thicknessTopAquiferLayer) + { + try + { + thicknesAquiferLayer.Mean = (RoundedDouble)thicknessTopAquiferLayer; + } + catch (ArgumentOutOfRangeException) + { + thicknesAquiferLayer.Mean = (RoundedDouble)double.NaN; + } + } + + private static double GetThicknessTopAquiferLayer(PipingSoilProfile soilProfile, RingtoetsPipingSurfaceLine surfaceLine, double exitPointL) + { + try + { + var zAtL = surfaceLine.GetZAtL(exitPointL); + return soilProfile.GetTopAquiferLayerThicknessBelowLevel(zAtL); + } + catch (ArgumentOutOfRangeException) + { + return double.NaN; + } + catch (ArgumentException) + { + return double.NaN; + } + } + + private void TrySetThicknessCoverageLayer(LognormalDistribution thicknessCoverageLayer) + { + try + { + thicknessCoverageLayer.Mean = (RoundedDouble)InputParameterCalculationService.CalculateThicknessCoverageLayer(input.WaterVolumetricWeight, PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), input.ExitPointL, input.SurfaceLine, input.SoilProfile); + } + catch (ArgumentOutOfRangeException) + { + thicknessCoverageLayer.Mean = (RoundedDouble)double.NaN; + } + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculation.cs =================================================================== diff -u -r7111c8fe6e124a95e6274bbfb3d9839492c96c09 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculation.cs (.../PipingCalculation.cs) (revision 7111c8fe6e124a95e6274bbfb3d9839492c96c09) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculation.cs (.../PipingCalculation.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -109,7 +109,6 @@ public void ClearHydraulicBoundaryLocation() { InputParameters.HydraulicBoundaryLocation = null; - InputParameters.AssessmentLevel = (RoundedDouble)Double.NaN; } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs =================================================================== diff -u -r0f6f1fc37266c0c6cf2c4b6301796ff168d9b955 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 0f6f1fc37266c0c6cf2c4b6301796ff168d9b955) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -52,7 +52,6 @@ private RoundedDouble piezometricHeadExit; private RingtoetsPipingSurfaceLine surfaceLine; - private readonly PipingInputSynchronizer synchronizer; private PipingSoilProfile soilProfile; private HydraulicBoundaryLocation hydraulicBoundaryLocation; @@ -106,8 +105,6 @@ Mean = (RoundedDouble) double.NaN, StandardDeviation = (RoundedDouble) 0.5 }; - - synchronizer = new PipingInputSynchronizer(this); } /// @@ -130,7 +127,6 @@ throw new ArgumentOutOfRangeException("value", Resources.PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero); } entryPointL = value.ToPrecision(entryPointL.NumberOfDecimalPlaces); - synchronizer.Synchronize(); } } @@ -154,7 +150,6 @@ throw new ArgumentOutOfRangeException("value", Resources.PipingInput_ExitPointL_Value_must_be_greater_than_zero); } exitPointL = value.ToPrecision(exitPointL.NumberOfDecimalPlaces); - synchronizer.Synchronize(); } } @@ -171,7 +166,6 @@ { surfaceLine = value; UpdateEntryAndExitPoint(); - synchronizer.Synchronize(); } } @@ -187,7 +181,6 @@ set { soilProfile = value; - synchronizer.Synchronize(); } } @@ -203,7 +196,6 @@ set { hydraulicBoundaryLocation = value; - synchronizer.Synchronize(); } } @@ -217,12 +209,9 @@ { get { - return assessmentLevel; + var derivedPipingInput = new DerivedPipingInput(this); + return derivedPipingInput.AssessmentLevel; } - internal set - { - assessmentLevel = value.ToPrecision(assessmentLevel.NumberOfDecimalPlaces); - } } /// @@ -233,12 +222,9 @@ { get { - return piezometricHeadExit; + var derivedPipingInput = new DerivedPipingInput(this); + return derivedPipingInput.PiezometricHeadExit; } - internal set - { - piezometricHeadExit = value.ToPrecision(piezometricHeadExit.NumberOfDecimalPlaces); - } } #endregion @@ -390,7 +376,6 @@ { phreaticLevelExit.Mean = value.Mean; phreaticLevelExit.StandardDeviation = value.StandardDeviation; - synchronizer.Synchronize(); } } @@ -402,13 +387,9 @@ { get { - return seepageLength; + var derivedPipingInput = new DerivedPipingInput(this); + return derivedPipingInput.SeepageLength; } - set - { - seepageLength.Mean = value.Mean; - seepageLength.StandardDeviation = value.StandardDeviation; - } } /// @@ -453,13 +434,9 @@ { get { - return thicknessAquiferLayer; + var derivedPipingInput = new DerivedPipingInput(this); + return derivedPipingInput.ThicknessAquiferLayer; } - set - { - thicknessAquiferLayer.Mean = value.Mean; - thicknessAquiferLayer.StandardDeviation = value.StandardDeviation; - } } /// @@ -470,13 +447,9 @@ { get { - return thicknessCoverageLayer; + var derivedPipingInput = new DerivedPipingInput(this); + return derivedPipingInput.ThicknessCoverageLayer; } - set - { - thicknessCoverageLayer.Mean = value.Mean; - thicknessCoverageLayer.StandardDeviation = value.StandardDeviation; - } } /// @@ -492,7 +465,6 @@ { dampingFactorExit.Mean = value.Mean; dampingFactorExit.StandardDeviation = value.StandardDeviation; - synchronizer.Synchronize(); } } Fisheye: Tag ba840423eb72501cbad89c1a6d88642531efa8d5 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInputSynchronizer.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj =================================================================== diff -u -r44055100aa3c3f382227becdaeae7d97c75d386c -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 44055100aa3c3f382227becdaeae7d97c75d386c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -53,14 +53,14 @@ Properties\GlobalAssembly.cs + - Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -0,0 +1,649 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.HydraRing.Data; +using Ringtoets.Piping.Data.Probabilistics; +using Ringtoets.Piping.Data.Properties; +using Ringtoets.Piping.KernelWrapper.SubCalculator; +using Ringtoets.Piping.KernelWrapper.TestUtil; +using Ringtoets.Piping.KernelWrapper.TestUtil.SubCalculator; +using Ringtoets.Piping.Primitives; + +namespace Ringtoets.Piping.Data.Test +{ + [TestFixture] + public class DerivedPipingInputTest + { + [Test] + public void Constructor_WithoutPipingInput_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new DerivedPipingInput(null); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Cannot create DerivedPipingInput without PipingInput."); + } + + [Test] + public void Constructor_WithPipingInput_DoesNotThrow() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(1.0, 1.1); + + // Call + TestDelegate call = () => new DerivedPipingInput(input); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void AssessmentLevel_InputHasNewHydraulicBoundaryLocationSet_AssessmentLevelUpdated() + { + // Setup + var input = new PipingInput(new GeneralPipingInput()); + var derivedInput = new DerivedPipingInput(input); + + double testLevel = new Random(21).NextDouble(); + + input.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0.0, 0.0) + { + DesignWaterLevel = testLevel + }; + + // Call + var calculatedAssesmentLevel = derivedInput.AssessmentLevel; + + // Assert + Assert.AreEqual(new RoundedDouble(2, testLevel), calculatedAssesmentLevel); + } + + [Test] + public void AssessmentLevel_InputWithoutHydraulicBoundaryLocationSet_AssessmentLevelSetToNaN() + { + // Setup + var input = new PipingInput(new GeneralPipingInput()); + var derivedInput = new DerivedPipingInput(input); + + input.HydraulicBoundaryLocation = null; + + // Call + var calculatedAssesmentLevel = derivedInput.AssessmentLevel; + + // Assert + Assert.IsNaN(calculatedAssesmentLevel); + } + + [Test] + public void PiezometricHeadExit_ValidInput_SetsParametersForCalculatorAndReturnsPiezometricHead() + { + // Setup + var input = new PipingInput(new GeneralPipingInput()); + var derivedInput = new DerivedPipingInput(input); + + using (new PipingSubCalculatorFactoryConfig()) + { + // Call + var piezometricHead = derivedInput.PiezometricHeadExit; + + // Assert + Assert.AreEqual(2, piezometricHead.NumberOfDecimalPlaces); + Assert.IsFalse(double.IsNaN(piezometricHead)); + + var factory = (TestPipingSubCalculatorFactory)PipingSubCalculatorFactory.Instance; + var piezometricHeadAtExitCalculator = factory.LastCreatedPiezometricHeadAtExitCalculator; + + Assert.AreEqual(derivedInput.AssessmentLevel.Value, piezometricHeadAtExitCalculator.HRiver); + Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.PhiPolder, + GetAccuracy(input.PhreaticLevelExit.Mean)); + Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.RExit, + GetAccuracy(input.DampingFactorExit.Mean)); + } + } + + [Test] + public void PiezometricHeadExit_InputWithAssessmentLevelMissing_PiezometricHeadSetToNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(1.0, 1.0); + var derivedInput = new DerivedPipingInput(input); + + // Call + var piezometricHead = derivedInput.PiezometricHeadExit; + + // Assert + Assert.IsNaN(piezometricHead); + } + + [Test] + public void ThicknessAquiferLayer_SoilProfileSingleAquiferAndCoverageUnderSurfaceLine_ReturnsThicknessAquiferLayer() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + + // Call + var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.AreEqual(1.0, thicknessAquiferLayer.Mean.Value); + } + + [Test] + public void ThicknessCoverageLayer_SoilProfileSingleAquiferAndCoverageUnderSurfaceLine_ReturnsThicknessCoverageLayer() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + + // Call + var thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + Assert.AreEqual(2.0, thicknessCoverageLayer.Mean.Value); + } + + [Test] + public void ThicknessAquiferLayer_InputWithoutSoilProfile_MeansSetToNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.SoilProfile = null; + var derivedInput = new DerivedPipingInput(input); + + // Call + var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessCoverageLayer_InputWithoutSoilProfile_MeansSetToNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.SoilProfile = null; + var derivedInput = new DerivedPipingInput(input); + + // Call + var thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_InputWithoutSurfaceLine_MeansSetToNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.SurfaceLine = null; + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessAquiferLayer = null; + Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + TestHelper.AssertLogMessagesCount(call, 0); + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessCoverageLayer_InputWithoutSurfaceLine_MeansSetToNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.SurfaceLine = null; + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessCoverageLayer = null; + Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + TestHelper.AssertLogMessagesCount(call, 0); + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + [TestCase(1e-6)] + [TestCase(1)] + public void ThicknessCoverageLayer_SoilProfileSingleAquiferAboveSurfaceLine_ThicknessCoverageLayerNaNAndLog(double deltaAboveSurfaceLine) + { + // Setup + var input = CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine); + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessCoverageLayer = null; + Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + var messages = new[] + { + Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer + }; + TestHelper.AssertLogMessagesAreGenerated(call, messages, 1); + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + [TestCase(1e-6)] + [TestCase(1)] + public void ThicknessAquiferLayer_SoilProfileSingleAquiferAboveSurfaceLine_ThicknessCoverageLayerNaNAndLog(double deltaAboveSurfaceLine) + { + // Setup + var input = CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine); + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessAquiferLayer = null; + Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + var messages = new[] + { + Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, + }; + TestHelper.AssertLogMessagesAreGenerated(call, messages, 1); + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_SoilProfileMultipleAquiferUnderSurfaceLine_AquiferMeanSetToTopAquiferThickness() + { + // Setup + double expectedThickness; + var input = CreateInputWithMultipleAquiferLayersUnderSurfaceLine(out expectedThickness); + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-8); + } + + [Test] + public void ThicknessAquiferLayer_MeanSetExitPointSetToNaN_ThicknessAquiferLayerNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.ExitPointL = (RoundedDouble) double.NaN; + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessAquiferLayer = null; + Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + TestHelper.AssertLogMessagesCount(call, 0); + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_MeanSetExitPointSetBeyondSurfaceLine_ThicknessAquiferLayerNaNAndLog() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.ExitPointL = (RoundedDouble) 3.0; + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessAquiferLayer = null; + Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + var messages = new[] + { + Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, + }; + TestHelper.AssertLogMessagesAreGenerated(call, messages, 1); + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessCoverageLayer_MeanSetExitPointSetBeyondSurfaceLine_ThicknessAquiferLayerNaNAndLog() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.ExitPointL = (RoundedDouble)3.0; + var derivedInput = new DerivedPipingInput(input); + + // Call + LognormalDistribution thicknessCoverageLayer = null; + Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + var messages = new[] + { + Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer + }; + TestHelper.AssertLogMessagesAreGenerated(call, messages, 1); + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + public void ThicknessCoverageLayer_MeanSetSoilProfileSetToNull_ThicknessCoverageLayerNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + input.ThicknessCoverageLayer.Mean = new RoundedDouble(2, new Random(21).NextDouble() + 1); + var derivedInput = new DerivedPipingInput(input); + + input.SoilProfile = null; + + // Call + LognormalDistribution thicknessCoverageLayer = null; + Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + TestHelper.AssertLogMessagesCount(call, 0); + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + public void ThicknessCoverageLayer_ProfileWithoutAquiferLayer_ThicknessCoverageLayerNaNAndLog() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SoilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(2.0) + { + IsAquifer = false + } + }, 0); + + // Call + LognormalDistribution thicknessCoverageLayer = null; + Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + var messages = new[] + { + Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer + }; + TestHelper.AssertLogMessagesAreGenerated(call, messages, 1); + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_ProfileWithoutAquiferLayer_ThicknessAquiferLayerNaNAndLog() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SoilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(2.0) + { + IsAquifer = false + } + }, 0); + + // Call + LognormalDistribution thicknessAquiferLayer = null; + Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + var messages = new[] + { + Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, + }; + TestHelper.AssertLogMessagesAreGenerated(call, messages, 1); + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_SoilProfileSingleAquiferUnderSurfaceLine_ThicknessAquiferLayerMeanSet() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + + // Call + var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.AreEqual(1.0, thicknessAquiferLayer.Mean.Value); + } + + [Test] + public void ThicknessAquiferLayer_SoilProfileMultipleAquiferUnderSurfaceLine_MeanSetToTopAquiferThickness() + { + // Setup + double expectedThickness; + var input = CreateInputWithMultipleAquiferLayersUnderSurfaceLine(out expectedThickness); + var derivedInput = new DerivedPipingInput(input); + + // Call + var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-8); + } + + [Test] + public void ThicknessAquiferLayer_MeanSetSoilProfileSetToNull_ThicknessAquiferLayerNaN() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + + input.SoilProfile = null; + + // Call + var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_InputResultsInZeroAquiferThickness_ThicknessAquiferLayerNaNAndLog() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SoilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(2.0) + { + IsAquifer = false + }, + new PipingSoilLayer(0.0) + { + IsAquifer = true + } + }, 0); + + // Call + LognormalDistribution thicknessAquiferLayer = null; + Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + var message = Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer; + TestHelper.AssertLogMessageIsGenerated(call, message, 1); + Assert.IsNaN(thicknessAquiferLayer.Mean); + } + + [Test] + public void ThicknessCoverageLayer_InputResultsInZeroCoverageThickness_ThicknessCoverageLayerNaNAndLog() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SoilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(2.0) + { + IsAquifer = false + }, + new PipingSoilLayer(2.0) + { + IsAquifer = true + } + }, 0); + + // Call + LognormalDistribution thicknessCoverageLayer = null; + Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer; + + // Assert + var message = Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer; + TestHelper.AssertLogMessageIsGenerated(call, message, 1); + Assert.IsNaN(thicknessCoverageLayer.Mean); + } + + [Test] + public void ThicknessAquiferLayer_SurfaceLineHalfWayProfileLayer_ThicknessSetToLayerHeightUnderSurfaceLine() + { + // Setup + var input = CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SoilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(2.5) + { + IsAquifer = true + }, + new PipingSoilLayer(1.5) + { + IsAquifer = true + } + }, 0); + + // Call + var thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer; + + // Assert + Assert.AreEqual(0.5, thicknessAquiferLayer.Mean.Value); + } + + private static PipingInput CreateInputWithAquiferAndCoverageLayer(double thicknessAquiferLayer = 1.0, double thicknessCoverageLayer = 2.0) + { + var surfaceLine = new RingtoetsPipingSurfaceLine(); + surfaceLine.SetGeometry(new[] + { + new Point3D(0, 0, thicknessCoverageLayer), + new Point3D(1.0, 0, thicknessCoverageLayer) + }); + var soilProfile = new PipingSoilProfile(String.Empty, -thicknessAquiferLayer, new[] + { + new PipingSoilLayer(thicknessCoverageLayer) + { + IsAquifer = false + }, + new PipingSoilLayer(0.0) + { + IsAquifer = true + } + }, 0); + + return new PipingInput(new GeneralPipingInput()) + { + SurfaceLine = surfaceLine, + SoilProfile = soilProfile, + ExitPointL = (RoundedDouble)0.5 + }; + } + + private static PipingInput CreateInputWithSingleAquiferLayerAboveSurfaceLine(double deltaAboveSurfaceLine) + { + var surfaceLine = new RingtoetsPipingSurfaceLine(); + var surfaceLineTopLevel = 2.0; + surfaceLine.SetGeometry(new[] + { + new Point3D(0, 0, surfaceLineTopLevel), + new Point3D(1.0, 0, surfaceLineTopLevel), + }); + var soilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(surfaceLineTopLevel + deltaAboveSurfaceLine + 2) + { + IsAquifer = false + }, + new PipingSoilLayer(surfaceLineTopLevel + deltaAboveSurfaceLine + 1) + { + IsAquifer = true + }, + new PipingSoilLayer(surfaceLineTopLevel + deltaAboveSurfaceLine) + { + IsAquifer = false + } + }, 0); + var input = new PipingInput(new GeneralPipingInput()) + { + SurfaceLine = surfaceLine, + SoilProfile = soilProfile, + ExitPointL = (RoundedDouble)0.5 + }; + return input; + } + + private static PipingInput CreateInputWithMultipleAquiferLayersUnderSurfaceLine(out double expectedThickness) + { + var surfaceLine = new RingtoetsPipingSurfaceLine(); + surfaceLine.SetGeometry(new[] + { + new Point3D(0, 0, 3.3), + new Point3D(1.0, 0, 3.3), + }); + var soilProfile = new PipingSoilProfile(String.Empty, 0, new[] + { + new PipingSoilLayer(4.3) + { + IsAquifer = false + }, + new PipingSoilLayer(3.3) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }, 0); + var input = new PipingInput(new GeneralPipingInput()) + { + SurfaceLine = surfaceLine, + SoilProfile = soilProfile, + ExitPointL = (RoundedDouble)0.5 + }; + expectedThickness = 2.2; + return input; + } + + private static double GetAccuracy(RoundedDouble roundedDouble) + { + return Math.Pow(10.0, -roundedDouble.NumberOfDecimalPlaces); + } + } +} Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingCalculationTest.cs =================================================================== diff -u -rd44768a07c5571dc44916a4576a438dbdb49a9c9 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingCalculationTest.cs (.../PipingCalculationTest.cs) (revision d44768a07c5571dc44916a4576a438dbdb49a9c9) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingCalculationTest.cs (.../PipingCalculationTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -217,7 +217,10 @@ // Setup var calculation = new PipingCalculation(new GeneralPipingInput(), new SemiProbabilisticPipingInput()); var assessmentLevel = new RoundedDouble(2, 7.60); - calculation.InputParameters.AssessmentLevel = assessmentLevel; + calculation.InputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0.0, 0.0) + { + DesignWaterLevel = assessmentLevel + }; // Precondition Assert.AreEqual(assessmentLevel, calculation.InputParameters.AssessmentLevel); Fisheye: Tag ba840423eb72501cbad89c1a6d88642531efa8d5 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputSynchronizerTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -265,31 +265,6 @@ } [Test] - public void ThicknessCoverageLayer_SetNewValue_UpdateMeanAndStandardDeviation() - { - // Setup - var inputs = new PipingInput(new GeneralPipingInput()); - LognormalDistribution originalThicknessCoverageLayer = inputs.ThicknessCoverageLayer; - - var newValue = new LognormalDistribution(5) - { - Mean = (RoundedDouble)1.23456, - StandardDeviation = (RoundedDouble)7.89123 - }; - - // Call - inputs.ThicknessCoverageLayer = newValue; - - // Assert - Assert.AreSame(originalThicknessCoverageLayer, inputs.ThicknessCoverageLayer, - "Stochast instance hasn't changed to 'newValue'."); - Assert.AreEqual(2, originalThicknessCoverageLayer.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(1.23, originalThicknessCoverageLayer.Mean.Value); - Assert.AreEqual(2, originalThicknessCoverageLayer.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(7.89, originalThicknessCoverageLayer.StandardDeviation.Value); - } - - [Test] public void SaturatedVolumicWeightOfCoverageLayer_SetNewValue_UpdateMeanAndStandardDeviation() { // Setup @@ -318,31 +293,6 @@ } [Test] - public void SeepageLength_SetNewValue_UpdateMeanAndStandardDeviation() - { - // Setup - var inputs = new PipingInput(new GeneralPipingInput()); - LognormalDistribution originalSeepageLength = inputs.SeepageLength; - - var newValue = new LognormalDistribution(5) - { - Mean = (RoundedDouble)5.55555, - StandardDeviation = (RoundedDouble)6.66666 - }; - - // Call - inputs.SeepageLength = newValue; - - // Assert - Assert.AreSame(originalSeepageLength, inputs.SeepageLength, - "Stochast instance hasn't changed to 'newValue'."); - Assert.AreEqual(2, originalSeepageLength.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(5.56, originalSeepageLength.Mean.Value); - Assert.AreEqual(2, originalSeepageLength.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(6.67, originalSeepageLength.StandardDeviation.Value); - } - - [Test] public void Diameter70_SetNewValue_UpdateMeanAndStandardDeviation() { // Setup @@ -391,30 +341,5 @@ Assert.AreEqual(3, originalDarcyPermeability.StandardDeviation.NumberOfDecimalPlaces); Assert.AreEqual(859.490, originalDarcyPermeability.StandardDeviation.Value); } - - [Test] - public void ThicknessAquiferLayer_SetNewValue_UpdateMeanAndStandardDeviation() - { - // Setup - var inputs = new PipingInput(new GeneralPipingInput()); - LognormalDistribution originalThicknessAquiferLayer = inputs.ThicknessAquiferLayer; - - var newValue = new LognormalDistribution(5) - { - Mean = (RoundedDouble)12.34567, - StandardDeviation = (RoundedDouble)89.12345 - }; - - // Call - inputs.ThicknessAquiferLayer = newValue; - - // Assert - Assert.AreSame(originalThicknessAquiferLayer, inputs.ThicknessAquiferLayer, - "Stochast instance hasn't changed to 'newValue'."); - Assert.AreEqual(2, originalThicknessAquiferLayer.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(12.35, originalThicknessAquiferLayer.Mean.Value); - Assert.AreEqual(2, originalThicknessAquiferLayer.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(89.12, originalThicknessAquiferLayer.StandardDeviation.Value); - } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj =================================================================== diff -u -r238411e28abf2f71dc0a5715ca940c6e87df9392 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 238411e28abf2f71dc0a5715ca940c6e87df9392) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -54,13 +54,13 @@ + - Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs =================================================================== diff -u -r0adc6562a9cedb81859034ef5d62e9b11db4d9c7 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision 0adc6562a9cedb81859034ef5d62e9b11db4d9c7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -16,21 +16,25 @@ public static PipingCalculation CreateCalculationWithValidInput() { var random = new Random(22); - var bottom = random.NextDouble(); - var top = bottom + random.NextDouble(); - var soilProfile = new PipingSoilProfile(String.Empty, bottom, new[] + var bottom = 1.12; + var top = 10.56; + var soilProfile = new PipingSoilProfile(String.Empty, 0.0, new[] { new PipingSoilLayer(top) { + IsAquifer = false + }, + new PipingSoilLayer(top / 2) + { IsAquifer = true } }, 0); var surfaceLine = new RingtoetsPipingSurfaceLine(); - var firstCharacteristicPointLocation = new Point3D(0.2, 0.0, top/6); - var secondCharacteristicPointLocation = new Point3D(0.3, 0.0, 2*top/6); - var thirdCharacteristicPointLocation = new Point3D(0.4, 0.0, 3*top/6); - var fourthCharacteristicPointLocation = new Point3D(0.5, 0.0, 4*top/6); - var fifthCharacteristicPointLocation = new Point3D(0.6, 0.0, 5*top/6); + var firstCharacteristicPointLocation = new Point3D(0.2, 0.0, bottom + 3 * top/ 4); + var secondCharacteristicPointLocation = new Point3D(0.3, 0.0, bottom + 2 * top / 4); + var thirdCharacteristicPointLocation = new Point3D(0.4, 0.0, bottom + top / 4); + var fourthCharacteristicPointLocation = new Point3D(0.5, 0.0, bottom + 2 * top / 4); + var fifthCharacteristicPointLocation = new Point3D(0.6, 0.0, bottom + 3 * top / 4); surfaceLine.SetGeometry(new[] { new Point3D(0.0, 0.0, 0.0), @@ -67,7 +71,6 @@ { Mean = (RoundedDouble) 1.0 }, - ExitPointL = (RoundedDouble) 1.0, PhreaticLevelExit = { Mean = (RoundedDouble) 2.0 Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r0f6f1fc37266c0c6cf2c4b6301796ff168d9b955 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 0f6f1fc37266c0c6cf2c4b6301796ff168d9b955) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -71,16 +71,19 @@ // Call & Assert Assert.AreSame(inputParameters.PhreaticLevelExit, properties.PhreaticLevelExit.Distribution); Assert.AreSame(inputParameters.DampingFactorExit, properties.DampingFactorExit.Distribution); - Assert.AreSame(inputParameters.ThicknessCoverageLayer, properties.ThicknessCoverageLayer.Distribution); + Assert.AreEqual(inputParameters.ThicknessCoverageLayer.Mean, properties.ThicknessCoverageLayer.Distribution.Mean); + Assert.AreEqual(inputParameters.ThicknessCoverageLayer.StandardDeviation, properties.ThicknessCoverageLayer.Distribution.StandardDeviation); Assert.AreSame(inputParameters.Diameter70, properties.Diameter70.Distribution); Assert.AreSame(inputParameters.DarcyPermeability, properties.DarcyPermeability.Distribution); - Assert.AreSame(inputParameters.ThicknessAquiferLayer, properties.ThicknessAquiferLayer.Distribution); + Assert.AreEqual(inputParameters.ThicknessAquiferLayer.Mean, properties.ThicknessAquiferLayer.Distribution.Mean); + Assert.AreEqual(inputParameters.ThicknessAquiferLayer.StandardDeviation, properties.ThicknessAquiferLayer.Distribution.StandardDeviation); Assert.AreSame(inputParameters.SaturatedVolumicWeightOfCoverageLayer, properties.SaturatedVolumicWeightOfCoverageLayer.Distribution); Assert.AreEqual(inputParameters.AssessmentLevel, properties.AssessmentLevel); Assert.AreEqual(inputParameters.PiezometricHeadExit, properties.PiezometricHeadExit); - Assert.AreSame(inputParameters.SeepageLength, properties.SeepageLength.Distribution); + Assert.AreEqual(inputParameters.SeepageLength.Mean, properties.SeepageLength.Distribution.Mean); + Assert.AreEqual(inputParameters.SeepageLength.StandardDeviation, properties.SeepageLength.Distribution.StandardDeviation); Assert.AreEqual(inputParameters.SeepageLength.Mean, properties.ExitPointL - properties.EntryPointL); Assert.AreEqual(inputParameters.ExitPointL, properties.ExitPointL); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs (.../PipingCalculationContextTreeNodeInfoTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs (.../PipingCalculationContextTreeNodeInfoTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -14,6 +14,7 @@ using Ringtoets.Common.Data; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data; +using Ringtoets.Piping.Data.TestUtil; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.KernelWrapper.TestUtil; using Ringtoets.Piping.Plugin; @@ -607,8 +608,7 @@ var observer = mocks.StrictMock(); var treeViewControlMock = mocks.StrictMock(); var calculateContextMenuItemIndex = 1; - var calculation = new PipingCalculation(new GeneralPipingInput(), new SemiProbabilisticPipingInput()); - var validPipingInput = new TestPipingInput(); + var calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); var pipingFailureMechanismMock = mocks.StrictMock(); var assessmentSectionBaseMock = mocks.StrictMock(); var pipingCalculationContext = new PipingCalculationContext(calculation, @@ -626,20 +626,6 @@ plugin.Gui = gui; - calculation.InputParameters.DampingFactorExit.Mean = (RoundedDouble)validPipingInput.DampingFactorExit; - calculation.InputParameters.DarcyPermeability.Mean = (RoundedDouble)validPipingInput.DarcyPermeability; - calculation.InputParameters.Diameter70.Mean = (RoundedDouble)validPipingInput.Diameter70; - calculation.InputParameters.ExitPointL = validPipingInput.ExitPointXCoordinate; - calculation.InputParameters.PhreaticLevelExit.Mean = (RoundedDouble)validPipingInput.PhreaticLevelExit; - calculation.InputParameters.SeepageLength.Mean = (RoundedDouble)validPipingInput.SeepageLength; - calculation.InputParameters.ThicknessAquiferLayer.Mean = (RoundedDouble)validPipingInput.ThicknessAquiferLayer; - calculation.InputParameters.ThicknessCoverageLayer.Mean = (RoundedDouble)validPipingInput.ThicknessCoverageLayer; - calculation.InputParameters.SurfaceLine = validPipingInput.SurfaceLine; - calculation.InputParameters.SoilProfile = validPipingInput.SoilProfile; - calculation.InputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty,0.0,0.0) { - DesignWaterLevel = validPipingInput.AssessmentLevel - }; - calculation.Attach(observer); var contextMenuAdapter = info.ContextMenuStrip(pipingCalculationContext, null, treeViewControlMock); Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorTest.cs =================================================================== diff -u -r0adc6562a9cedb81859034ef5d62e9b11db4d9c7 -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision 0adc6562a9cedb81859034ef5d62e9b11db4d9c7) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -5,7 +5,6 @@ using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; -using Ringtoets.Piping.Data; using Ringtoets.Piping.KernelWrapper.SubCalculator; using Ringtoets.Piping.KernelWrapper.TestUtil; using Ringtoets.Piping.Primitives; Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs =================================================================== diff -u -r89488cc05b12fd5720cd28a4eeeb001dc9b1456d -rba840423eb72501cbad89c1a6d88642531efa8d5 --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs (.../PipingSemiProbabilisticDesignValueFactoryTest.cs) (revision 89488cc05b12fd5720cd28a4eeeb001dc9b1456d) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs (.../PipingSemiProbabilisticDesignValueFactoryTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) @@ -18,7 +18,8 @@ var thicknessCoverageLayer = PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(inputParameters); // Assert - Assert.AreSame(inputParameters.ThicknessCoverageLayer, thicknessCoverageLayer.Distribution); + Assert.AreEqual(inputParameters.ThicknessCoverageLayer.Mean, thicknessCoverageLayer.Distribution.Mean); + Assert.AreEqual(inputParameters.ThicknessCoverageLayer.StandardDeviation, thicknessCoverageLayer.Distribution.StandardDeviation); Assert.AreEqual(0.05, thicknessCoverageLayer.Percentile); } @@ -78,7 +79,8 @@ var seepageLength = PipingSemiProbabilisticDesignValueFactory.GetSeepageLength(inputParameters); // Assert - Assert.AreSame(inputParameters.SeepageLength, seepageLength.Distribution); + Assert.AreEqual(inputParameters.SeepageLength.Mean, seepageLength.Distribution.Mean); + Assert.AreEqual(inputParameters.SeepageLength.StandardDeviation, seepageLength.Distribution.StandardDeviation); Assert.AreEqual(0.05, seepageLength.Percentile); } @@ -120,7 +122,8 @@ var thicknessAquiferLayer = PipingSemiProbabilisticDesignValueFactory.GetThicknessAquiferLayer(inputParameters); // Assert - Assert.AreSame(inputParameters.ThicknessAquiferLayer, thicknessAquiferLayer.Distribution); + Assert.AreEqual(inputParameters.ThicknessAquiferLayer.Mean, thicknessAquiferLayer.Distribution.Mean); + Assert.AreEqual(inputParameters.ThicknessAquiferLayer.StandardDeviation, thicknessAquiferLayer.Distribution.StandardDeviation); Assert.AreEqual(0.95, thicknessAquiferLayer.Percentile); }