Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -rc0a3ced404197fd781c6fcbcfc21c6676592be57 -r252605cde31dfde56c723feb0cf14b8597d12430 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision c0a3ced404197fd781c6fcbcfc21c6676592be57) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 252605cde31dfde56c723feb0cf14b8597d12430) @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Linq; using Core.Common.Base; @@ -14,6 +15,7 @@ using Ringtoets.Piping.Data.Probabilistics; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.PropertyClasses; +using Ringtoets.Piping.Forms.TypeConverters; namespace Ringtoets.Piping.Forms.Test.PropertyClasses { @@ -412,6 +414,46 @@ mocks.VerifyAll(); } + [Test] + [TestCase(1)] + [TestCase(2)] + public void GivenCompletePipingInputContextProperties_WhenPhreaticLevelExitPropertiesSetThroughProperties_ThenPiezometricHeadExitUpdated(int propertyIndexToChange) + { + // Given + var mocks = new MockRepository(); + var typeDescriptorContextMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + + var inputParameters = new PipingInput(new GeneralPipingInput()); + var contextProperties = new PipingInputContextProperties + { + Data = new PipingInputContext(inputParameters, + Enumerable.Empty(), + Enumerable.Empty(), + assessmentSectionMock) + }; + inputParameters.PiezometricHeadExit = (RoundedDouble)double.NaN; + inputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0) + { + DesignWaterLevel = 1.0 + }; + + var dynamicPropertyBag = new DynamicPropertyBag(contextProperties); + typeDescriptorContextMock.Expect(tdc => tdc.Instance).Return(dynamicPropertyBag); + mocks.ReplayAll(); + + DesignVariable phreaticLevelExitProperty = contextProperties.PhreaticLevelExit; + PropertyDescriptorCollection properties = new NormalDistributionDesignVariableTypeConverter().GetProperties(typeDescriptorContextMock, phreaticLevelExitProperty); + Assert.NotNull(properties); + + // When + properties[propertyIndexToChange].SetValue(phreaticLevelExitProperty, (RoundedDouble)2.3); + + // Then + Assert.IsFalse(double.IsNaN(inputParameters.PiezometricHeadExit)); + mocks.VerifyAll(); + } + private static RingtoetsPipingSurfaceLine ValidSurfaceLine(double xMin, double xMax) { var surfaceLine = new RingtoetsPipingSurfaceLine();