Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs =================================================================== diff -u -rd0edc31646a3408dcb6116e8e5eedf86e4c51ea9 -recb753a5b17dd2e9cb0658ffb5a0a6d5a730c62f --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision d0edc31646a3408dcb6116e8e5eedf86e4c51ea9) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision ecb753a5b17dd2e9cb0658ffb5a0a6d5a730c62f) @@ -69,28 +69,39 @@ private const int diameter70PropertyIndex = 17; private const int saturatedVolumicWeightOfCoverageLayerPropertyIndex = 18; + private readonly Func getCalculatedAssessmentLevel; private readonly IObservablePropertyChangeHandler propertyChangeHandler; /// /// Creates a new instance of . /// /// The instance to show the properties for. - /// The handler responsible for handling effects of a property change. + /// for obtaining the calculated assessment level. + /// The handler responsible for handling effects of a property change. /// Thrown when any parameter is null. public PipingInputContextProperties(PipingInputContext data, - IObservablePropertyChangeHandler handler) + Func getCalculatedAssessmentLevel, + IObservablePropertyChangeHandler propertyChangeHandler) { if (data == null) { throw new ArgumentNullException(nameof(data)); } - if (handler == null) + + if (getCalculatedAssessmentLevel == null) { - throw new ArgumentNullException(nameof(handler)); + throw new ArgumentNullException(nameof(getCalculatedAssessmentLevel)); } + if (propertyChangeHandler == null) + { + throw new ArgumentNullException(nameof(propertyChangeHandler)); + } + Data = data; - propertyChangeHandler = handler; + + this.getCalculatedAssessmentLevel = getCalculatedAssessmentLevel; + this.propertyChangeHandler = propertyChangeHandler; } /// @@ -110,6 +121,7 @@ { return data.AvailableStochasticSoilModels; } + return PipingCalculationConfigurationHelper.GetStochasticSoilModelsForSurfaceLine(data.WrappedData.SurfaceLine, data.AvailableStochasticSoilModels); } @@ -131,6 +143,7 @@ { return !data.WrappedData.UseAssessmentLevelManualInput; } + if (propertyName == nameof(EntryPointL) || propertyName == nameof(ExitPointL)) { return data.WrappedData.SurfaceLine == null; @@ -256,7 +269,11 @@ { get { - return DerivedPipingInput.GetPiezometricHeadExit(data.WrappedData); + RoundedDouble assessmentLevel = data.WrappedData.UseAssessmentLevelManualInput + ? data.WrappedData.AssessmentLevel + : getCalculatedAssessmentLevel(); + + return DerivedPipingInput.GetPiezometricHeadExit(data.WrappedData, assessmentLevel); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r487d53ee7ab88f79d75c4932266eaafe08df1a56 -recb753a5b17dd2e9cb0658ffb5a0a6d5a730c62f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 487d53ee7ab88f79d75c4932266eaafe08df1a56) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision ecb753a5b17dd2e9cb0658ffb5a0a6d5a730c62f) @@ -80,7 +80,7 @@ mocks.ReplayAll(); // Call - TestDelegate test = () => new PipingInputContextProperties(null, handler); + TestDelegate test = () => new PipingInputContextProperties(null, () => (RoundedDouble) 1.1, handler); // Assert var exception = Assert.Throws(test); @@ -89,11 +89,12 @@ } [Test] - public void Constructor_HandlerNull_ThrowArgumentNullException() + public void Constructor_GetAssessmentLevelFuncNull_ThrowArgumentNullException() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); + var handler = mocks.Stub(); mocks.ReplayAll(); var calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); @@ -107,15 +108,42 @@ assessmentSection); // Call - TestDelegate test = () => new PipingInputContextProperties(context, null); + TestDelegate test = () => new PipingInputContextProperties(context, null, handler); // Assert var exception = Assert.Throws(test); - Assert.AreEqual("handler", exception.ParamName); + Assert.AreEqual("getAssessmentLevelFunc", exception.ParamName); mocks.VerifyAll(); } [Test] + public void Constructor_PropertyChangeHandlerNull_ThrowArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); + var failureMechanism = new PipingFailureMechanism(); + + var context = new PipingInputContext(calculationItem.InputParameters, + calculationItem, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, + assessmentSection); + + // Call + TestDelegate test = () => new PipingInputContextProperties(context, () => (RoundedDouble) 1.1, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("propertyChangeHandler", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] public void Constructor_WithParameters_ExpectedValues() { var mocks = new MockRepository();